asp.net - One to Many Assosiation without a collection on many Side EF -
i have baseentity :
public class baseentity<t> { public baseentity() { this.createddate = system.datetime.now; this.updatetddate = system.datetime.now; } [system.componentmodel.dataannotations.key] [system.componentmodel.dataannotations.required] [system.componentmodel.dataannotations.schema.column("id")] [system.componentmodel.dataannotations.schema. databasegenerated(system.componentmodel.dataannotations.schema.databasegeneratedoption.identity)] public t id { get; set; } [system.componentmodel.dataannotations.required] [system.componentmodel.dataannotations.schema.foreignkey("created_by")] public virtual bonchaghwebapplication.models.core.user createdby { get; set; } [system.componentmodel.dataannotations.required] [system.componentmodel.dataannotations.schema.foreignkey("updated_by")] public virtual bonchaghwebapplication.models.core.user updatedby { get; set; } [system.componentmodel.dataannotations.required] public datetime createddate { get; set; } [system.componentmodel.dataannotations.required] public datetime updatetddate { get; set; } } }
and :
[system.componentmodel.dataannotations.schema.table("app_user")] public class user:baseentity<long> { public string username { get; set; } public string password { get; set; } }
and these 2 have 1 many relation, don't need collection on user side, record saved user , doesn't matter user save witch records
Comments
Post a Comment