Baturhan
Data seeding database
Yes unfortunetly. Well in that case If you are adding any data to the 100 tables manually you already have long code, an any method wouldn't hurt ya?
you can register your code to the applicationstart event, thus it's absolutely going to work once. it'd be useless if you define a variable to the program cs because it only works once already
74 replies
Data seeding database
if that variable is set to development yes, If you don't want ta seed again and again, you could check the data with "any" method.
If you try to execute your program in release mode it should be changed I guess, let me check it
74 replies
Data seeding database
Hello @joren,
you can check your enviorenment in program.cs using
app.Environment.IsDevelopment()
if this returns true you are in development, if the case is only debuggin
#if DEBUG
#end if
you can use this.
So when you release the application your enviorenment is going to be production(or the setting you set before) and the db is not going to be seed anymore
74 replies
EF navigation property is unattached from dbContext
Naming differs so much, I would prefer to use
public class User
{
public string Id { get; set; }
}
rather than UserId, because whenever you are accessing an user object you are going to use it myUserObj.Id so as you said If UserId naming is used there it may be confusing.
9 replies
EF navigation property is unattached from dbContext
Hello @Core ,
As you mentioned the 2nd option seemed better to me, however I can give you a new option also.
You can add a new property to the Domain,
public string UserId {get;set;}
While you are adding a related entity you can equal yourDomainObj.UserId = userId
This approach works well If you also don't update your user object as well beside you are not doing it.
9 replies