c# - Models / Entities vs complex types -


i have problem understanding complex data types vs entities in asp mvc , c#. started creating following type, not meant entity (db table):

public class period : iperiod {     public datetime { get; set; }     public datetime { get; set; } } 

i added type model:

public class event {     public int id { get; set; }     public string title { get; set; }     public period eventtime { get; set; } } 

this worked fine. seemed understand period complex type, not entity. added columns eventtime_from , eventtime_to event table.

however, added complexity period type removing interface, moving class different namespace , adding methods class. suddenly, when trying rebuild database, interpreted entitytype, throwing exception missing primary key.

what system here? when classes seen complex types, , when seen entities?

it hard going on without knowing changes made can tell ef explicitly period complex type either marking complextype attribute or using fluent mapping:

modelbuilder.complextype<period>(); 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -