Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am just try to creating Database using entity Framework5.0 code first Approach In Mvc web Application when i execute code it execute fine but not creating database.if i send input values from views then Database is created??? I Want to know whats the mechanism behind this entity frame work code Approach Can any one Help to find out the mechanism of entity frame work.

share|improve this question
1  
try reading this first How to Ask – aiapatag yesterday

2 Answers

I guess you are using the wrong database creation strategy

share|improve this answer
What kind of Wrong Strategy??? i have two basic classes of userLogin ,and User sign up class and anther class is UserContext class that is inherit from DbContext class and to create a databse table i use 'public DbSet<Category> Categories { get; set; } public DbSet<Product> Products { get; set; }' method for constr 'public OnlineShopContext() :base("Name=Constr3") { }' – Muhammd Waseem yesterday
And constr is ' <connectionStrings> <clear /> <add name="Constr3" connectionString="Data Source=.;Initial Catalog=EShop1;Integrated Security=true" providerName="System.Data.SqlClient" /> </connectionStrings> ' – Muhammd Waseem yesterday
I'm sorry, but what database creation strategies for code first are is something google can easily answer. – b_meyer yesterday

How do know it didn't create the database? If everything works fine, I mean no errors, the database should be created already.

My guess is you didn't specify the connection string which caused the database created in SQL Express.

share|improve this answer
first time when i execute the code then code do not show any error and execute fine and show the signup view when i finish the execution and check it does not make database. if i run again and provide the values in signup form then it create database. why this is odd behviour? it should create database when i execute and browse the page – Muhammd Waseem yesterday
Em providing conection String it works fine but its odd behaviour is distrubing me. – Muhammd Waseem yesterday
It will create database when you first access the database. I'm sure the signup httpget action doesn't access the database. – Jason Li yesterday
Oky Sure nd thanx for suggestion me solution – Muhammd Waseem yesterday
@MuhammdWaseem Then please mark it as answer – Jason Li 1 hour ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.