Switching from NHibernate to Massive or Dapper

c# dapper massive

Question

I understand the basic principles of the micro orm systems like massive and dapper, however i'm struggling with understanding how it's possible to model a table with relationships.

ie:

Category 1---M Product

In my NHibernate, or Linq2SQL solutions, Category has a List property. There doesn't seem to be any examples of how this kind of relationship can be modelled. Particularly in linq where we might select on a category where there are products with specific names.

Popular Answer

If you are thinking of shifting from any traditional ORM. I insist that you must watch this video posted by Rob Conery.

And the concern you showed in question about Domain Objects having another collection of domain objects as its property. It will not be an issue. Just a thing is this time you are putting values of that domain objected by your self.

Like here

Class Person
{
   public String FirstName{get;set;}
   public String LastName {get;set;}
   public IEnumarable<Address> {get;set;}
}

Class Address
{
   public String Address1 {get;set;}
   public String Address2 {get;set;}
}

Dynamic personData = new DynamicModel("connectionString","TableName","PrimaryKey");

var resultPerson = personData.All(where: "where condition") 
or 
var resultPerson = personData.Query("Join query will be here")

//Map resultPerson with PersonObject and return Person
//Still this will be faster than EF as per benchmark shown on Dapper page

I hope this will give your answer. If you need working code please let me know.




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why