2021年2月3日星期三

Navigational Property in Classes to use with Dapper

I have been trying to learn ORM and OOP for the longest time and I am just stuck at this it is just not nudging an inch forward,

I just cannot find out how to define Navigational property, (for me this means a property that defines an attribute who's function is to link two tables ), it has been so confusing

Before we go furhter this is the technologies that i implement :

  • WPF/C# (.NetFramework 4.7.2)
  • Dapper ORM
  • MySQL Database

I will not waste space and show you all of my experiments, instead i will just show you my project, this a cut down version of it, so that we can focus on navigation properties

DB Design

DOUBTS (These are the reasons i am confused can cannot complete)

  • When to use a collection and when not to, two examples (where should i use 1st and where should i use 2nd)

     public List<Object1> Object { get; set; }   public      Object1  Object { get; set; }  
  • Which type of collection to use : some use collection, some list, some observablecollection and some use letter 'I' infront of those mentioned above

  • Lastly why do we have two different properties relating the same table for example,

     public class User     {         public string Name { get; set; }         public int ContactID { get; set; }         public contact Contacts { get; set; }       }  

why is it like that first ContactID and then Contacts

https://stackoverflow.com/questions/66038338/navigational-property-in-classes-to-use-with-dapper February 04, 2021 at 09:59AM

没有评论:

发表评论