0
zaktecs created
Hi,
I would like to add my table (Classes) to the dbContext eg. Student(Id,Name), Teacher(Id,Name) but don't seem to see where to do it. Does it go in the "EntityFramework Project|"
Do you have link on documentation on how to add new database object to extend this starter park.?
Many thanks
Zak
3 Answer(s)
-
0
Hi,
There must be a DbContext class in your EntityFramework project under EntityFramework folder. You need to add your class to your DbContext.
-
0
Some code:
This is your new entity (place it somewhere in YourProject.Core project):
[Table("ReBid")] public class Bid : FullAuditedEntity<long> { public Bid() { CreationTime = Clock.Now; } [DataType(DataType.Currency)] [Column(TypeName = "money")] [Range(0, double.MaxValue)] public decimal Amount { get; set; } public long RegistrationId { get; set; } [ForeignKey("RegistrationId")] public virtual BidderRegistration Registration { get; set; } /// <summary>True if this is the winning bid of an auction</summary> public bool IsWinner { get; set; } }
Then add the proper IDbSet in the DbContext class you find in YourProject.EntityFramework project:
public class YourProjectDbContext : AbpZeroDbContext<Tenant, Role, User> { ... public virtual IDbSet<Bid> Bids { get; set; } ... }
-
0
Many thanks gpcaretti. I will give it a try