Tania Marinova
Tania Marinova

Reputation: 1898

Trying to move asp.net identity tables to my database

hello I'm trying to make an online store mvc applciation with view model and onion architecture. So in My interfaces folder I have my db context

class OnlineStoreDBContext:DbContext
    {
            public DbSet<Language> Languages { get; set; }
            public DbSet<Category> Categories { get; set; }
            public DbSet<CategoryLanguages> CategoryLanguages{ get; set; }
            public DbSet<Product> Product { get; set; }
            public DbSet<ProductLanguages> ProductLanguages { get; set; }
            public DbSet<ProductCategories> ProuctCategories { get; set; }
            public DbSet<Order> Orders { get; set; }
            public DbSet<OrderDetails> OrderDetails { get; set; }
            public DbSet<Customer> Customers { get; set; }


    }

And in my web.config of my mvc applciation I have the following connection to my database

 <add name="OnlineStoreDBContext" connectionString="Data Source=.\SQLexpress;Initial Catalog=OnlineStore;Integrated Security= true" providerName="System.Data.SqlClient" />

1.Now I try to use asp.net identity in visual studio 2013 BUT I WANT THE TABLES WHICH IDENTITY CREATES TO BE IN MY DATABASE OnlineStore which tables I create using the Code first Entity framework approach .

  1. As I want to extend user class can you provide me with a simple way to add more more field for the user identity.

I appreciate any help

Upvotes: 2

Views: 1452

Answers (1)

wooer
wooer

Reputation: 1717

I am very unfamiliar with MVC thing, sadly I can say.. But what I do in a similar situation was to create a connection string to your own DB in the web.config file but name it "DefaultConnection"

<add name="DefaultConnection" connectionString="Data Source=.\SQLexpress;Initial Catalog=OnlineStore;Integrated Security= true" providerName="System.Data.SqlClient" />

Then I run the application and proceeded to Register and registered as a user... Then I saw that the schema was created in my DB. Then I supposed you can add your own tables and stuff in that DB..

"1. As I want to extend user class can you provide me with a simple way to add more more field for the user identity."

If I haven't gotten it wrong you meant to add additional profile information. I am new a ASP.net Identity but with a quick search I found:

http://www.itorian.com/2013/11/customize-users-profile-in-aspnet.html

http://www.c-sharpcorner.com/UploadFile/4b0136/adding-profile-data-in-Asp-Net-identity-using-visual-studio/

Hope I helped a bit..

Upvotes: 4

Related Questions