I like keeping my database schema as clean and readable as possible, and one of the things I do is use a schema name to group related functionality.
I’ve been doing a fair bit of work with ASP.NET Identity recently, and one of the things was to add the generated tables for identity into their own schema. Moreover, I also wanted to change the name of the tables. This is a snap using Code First – all you need to do (in your IdentityDbContext derived class) is the following…
modelBuilder.Entity<DbUser>().ToTable("Users", "AUTH");
modelBuilder.Entity<IdentityUserRole>().ToTable("UserRoles", "AUTH");
modelBuilder.Entity<IdentityUserLogin>().ToTable("ExternalLogins", "AUTH");
modelBuilder.Entity<IdentityUserClaim>().ToTable("UserClaims", "AUTH");
modelBuilder.Entity<IdentityRole>().ToTable("Roles", "AUTH");
Make sure you call the base class OnModelCreating method before including these changes. With that you’ll get a nice set of tables inside SQL server…
I realise that this will mean that I need to be careful when installing a new version of ASP.NET Identity (to ensure that the override still works), but I’d rather pay that price and have a ‘clean’ schema.
10 comments:
Thanks for this tip, I’m sure everyone will keep it in mind. Please post some information about ASP.NET and how you’ve been using it. I’d really appreciate it.
I tried this and it does create the tables with the right schema and I am able to register a user. However, I cannot login to my application anymore because UserManager.FindAsync cannot find the user. Any thoughts on why this would stop working? Is there another code change that I need to make?
Nevermind...I figured it out. Had to pass the username instead of the email address. All is working!
You should definitely visit this blog for some information on how to write an essay. This will save your life in the future so do it as soon as possible.
توثيق الحادث الأصلي
أول شيء ستحتاج لإظهار المشتري المحتمل هو توثيق ما حدث. سيشمل ذلك نسخة من تقرير التفتيش أو النتائج التي توصل إليها المفتش ، والتي تبين أن لديك النمل الأبيض. ستحتاج بعد ذلك إلى إظهار وثائق العلاج التي تلقاها منزلك.شركة النجوم لمكافحة الحشرات
شركة مكافحة الصراصير بالرياض
شركة مكافحة فئران بالرياض
شركة مكافحة النمل الابيض بالرياض
Such an Informative post. I really like your blog.Thanks for sharing this. Basically I work with the web designers in logoistic and our aim is to design your dream website. Thanks again!
Such a nice read. I enjoy reading this post! dumpster for rent near me
Maintaining a clean and organized database schema is essential for efficient functionality. This approach, as described, not only enhances readability but also allows for better management, a practice that can also be beneficial when tackling Canadian essay writing service.
Offering Patient financing for medical offices can enhance accessibility to healthcare services by providing flexible payment options. This solution allows patients to manage out-of-pocket expenses through installment plans or credit programs. By partnering with financing companies, medical practices can alleviate financial barriers, ensuring patients receive necessary treatments without delay.
Implementing patient financing not only fosters patient satisfaction but also strengthens the financial health of medical offices, fostering a win-win situation for both healthcare providers and patients alike.
The next night, the couple walked into an adult product store, and best sex dolls heart was beating wildly.
Post a Comment