asp.net mvc 4 - code first with different entities -


i have 3 model classes , 3 views. models given below

 public class baslpapplicationformmodel         {             [key]             [databasegeneratedattribute(databasegeneratedoption.identity)]             public int baslpapplicationid { get; set; }               public string baslpapplicationno { get; set; }               public string applicantname { get; set; }              [datatype(datatype.date)]             [display(name = "date of birth", prompt = "dd/mm/yyyy")]             public datetime dateofbirth { get; set; }                       [required]             [display(name = "email-id")]                     public string emailid { get; set; }  } 

and second

  public class dpphiapplicationformmodel     {         [key]         [databasegeneratedattribute(databasegeneratedoption.identity)]         public int dpphiapplicationid { get; set; }           public string dpphiapplicationno { get; set; }          [required]         [display(name = "name of applicant")]         [datatype(datatype.text)]         public string name { get; set; }          [required]         [display(name = "expansion of initial")]         [datatype(datatype.text)]         public string initialexpansion { get; set; }           [datatype(datatype.date)]         [display(name = "date of birth", prompt = "mm/dd/yyyy")]         public datetime dateofbirth { get; set; }            [required]         [display(name = "email-id")]         [datatype(datatype.emailaddress)]         public string emailid { get; set; } } 

and third

    public class dtydhhapplicationformmodel     {         [key]         [databasegeneratedattribute(databasegeneratedoption.identity)]         public int dtydhhapplicationid { get; set; }               public string dtydhhaapplicationno { get; set; }          [required]         [display(name = "name of applicant")]         [datatype(datatype.text)]         public string name { get; set; }             [regularexpression("^([0-9]+)$", errormessage = "invalid phone number")]         [datatype(datatype.phonenumber)]         [display(name = "land line number")]         public string phone { get; set; }              [required]         [display(name = "email-id")]         [datatype(datatype.emailaddress)]         public string emailid { get; set; } } 

email model ,

[table("emails")]     public class useremails     {         [key]         [databasegeneratedattribute(databasegeneratedoption.identity)]         public int id { get; set; }          public string useremailid { get; set; }     } 

here user interacts of forms , submitting forms accordingly.

i email entries emails table using code first approach , please advice me how can achieve.

take @ serie of 3 blogposts:

  1. http://weblogs.asp.net/manavi/archive/2010/12/24/inheritance-mapping-strategies-with-entity-framework-code-first-ctp5-part-1-table-per-hierarchy-tph.aspx
  2. http://weblogs.asp.net/manavi/archive/2010/12/28/inheritance-mapping-strategies-with-entity-framework-code-first-ctp5-part-2-table-per-type-tpt.aspx
  3. http://weblogs.asp.net/manavi/archive/2010/12/24/inheritance-mapping-strategies-with-entity-framework-code-first-ctp5-part-1-table-per-hierarchy-tph.aspx

hope helps


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -