Results 1 to 4 of 4

Thread: Dapper ORM example in ASP.Net MVC Project

  1. #1

    Thread Starter
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Dapper ORM example in ASP.Net MVC Project

    Good day!

    Using the classes from the post ASP.NET Web Forms Project Using Dapper ORM with Dapper ORM features, this article demonstrates on how to use them in an ASP.NET MVC Project. I made some changes in Customer.cs class by applying DataAnnotations attributes such as Display and DisplayFormat.

    Code:
     public class Customer
    {
    	public int CustomerID { get; set; }
    
    	[Display(Name="Company Name")]
    	public string CompanyName { get; set; }
    
    	[Display(Name = "Address")]
    	public string Address { get; set; }
    
    	[Display(Name = "City")]
    	public string City { get; set; }
    
    	[Display(Name = "State")]
    	public string State { get; set; }
    
    	[Display(Name = "Intro Date")]
    	[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
    	public DateTime IntroDate { get; set; }
    
    	[Display(Name = "Credit Limit")]
    	[DisplayFormat(DataFormatString = "{0:n2}")]
    	public decimal CreditLimit { get; set; }
    }
    Name:  DapperMVC.jpg
Views: 8671
Size:  38.9 KB

    Source code: ASP.NET MVC Dapper (Github)

    Regards,
    Last edited by KGComputers; Feb 24th, 2017 at 10:24 AM. Reason: typo
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  2. #2
    Registered User
    Join Date
    Mar 2017
    Location
    Melbourne, Australia
    Posts
    1

    Re: Dapper ORM example in ASP.Net MVC Project

    Thankyou for this - it is the only example on the web that I have found, of using Dapper with ASP.Net MVC, that actually works!
    Now I just need to work out how it works :-) For instance I don't yet understand why you have a Repository, a Repository Interface, and a Service Class. No doubt there are things I can read about this.
    As you can see, I am a newbie to Dapper and MVC, even though I have been creating in-house business apps with ASP.Net WebForms for many years.
    Once again, you contribution is much appreciated, as I want to learn MVC, and Dapper is very appealing as a simple alternative to Entity.

  3. #3

    Thread Starter
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: Dapper ORM example in ASP.Net MVC Project

    Hi,

    Your welcome.. :-)

    - kgc
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  4. #4
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,208

    Re: Dapper ORM example in ASP.Net MVC Project

    Hi
    i tried a bit of Dapper, but tired Can u please have a look at this thread please
    http://www.vbforums.com/showthread.p...ghlight=dapper
    The averted nuclear war
    My notes:

    PrOtect your PC. MSDN Functions .OOP LINUX forum
    .LINQ LINQ videous
    If some one helps you please rate them with out fail , forum doesn't expects any thing other than this

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width