Baturhan
Baturhan
CC#
Created by SWEETPONY on 12/12/2023 in #help
✅ Is it possible to lock method by id?
your keyword is "Distributed Locks"
31 replies
CC#
Created by SWEETPONY on 12/12/2023 in #help
✅ Is it possible to lock method by id?
Use redis for distrubted lock
31 replies
CC#
Created by joren on 12/8/2023 in #help
Data seeding database
you can create an empty migration and can do whatever in there you want, there is no need to use library for only checking .Any()
74 replies
CC#
Created by joren on 12/8/2023 in #help
Data seeding database
catshy
74 replies
CC#
Created by joren on 12/8/2023 in #help
Data seeding database
yes it' seems enough in this case
74 replies
CC#
Created by joren on 12/8/2023 in #help
Data seeding database
It needs to create, ef core acts right, otherwise ef core couldn't create the entity.
74 replies
CC#
Created by joren on 12/8/2023 in #help
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
CC#
Created by joren on 12/8/2023 in #help
Data seeding database
Even if you add your data manually when thread comes to Any() method it's going to return true or false according to it
74 replies
CC#
Created by joren on 12/8/2023 in #help
Data seeding database
are you even trying to execute the db commands parallel? Any() just returns, if there is any data in the table. IF you added it it will true, thus you dont need to add any data to seed and you will return/continue
74 replies
CC#
Created by joren on 12/8/2023 in #help
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
CC#
Created by joren on 12/8/2023 in #help
Data seeding database
No description
74 replies
CC#
Created by joren on 12/8/2023 in #help
Data seeding database
Savechanges method just redirect your query to the db, it's not related with migration at all
74 replies
CC#
Created by joren on 12/8/2023 in #help
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
CC#
Created by hunterlan on 12/6/2023 in #help
No authenticationScheme was specified, and there was no DefaultChallengeScheme found.
Did you use "UseAuthorizion"
4 replies
CC#
Created by Core on 12/6/2023 in #help
EF navigation property is unattached from dbContext
Or you can use another naming like DomainUserId, and either in fluent api or with an attribute you can say it's a foreign key. It is completely up to you. I am happy if I could help you
9 replies
CC#
Created by Core on 12/6/2023 in #help
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
CC#
Created by Core on 12/6/2023 in #help
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