c# - Which method in EF5 is in charge of creating database -
i have couple of questions:
in ef5 code first api method in charge of checks if database exits, , if it's not case method creates database?
if use ef code first dal project , want ef generate other database testing purpose can using ef? i've changed initial catalog in connection string check if creates other database not , threw exception
by using ef code-first or database-first, have dbcontext class, ef5 how knows used method it's internal actions?
thanks.
api check if exists context.database.exists();
, context.database.createifnotexits();
as access ef context starts doing things. there default behavior can manipulate things.
a context can open again different db instances yes. can use create different dbs on same server. careful use of constructor , corresponsing api.config setting required.
<connectionstrings> <add name="youcanhavemanyoftheese" connectionstring="data source=localhost;initial catalog=different dbname ;integrated security=true;multipleactiveresultsets=true;app=entityframework" providername="system.data.sqlclient" />
also
check out database.setinitializer();
ef knows if created db, or migrated db. actions recorded here. [dbo].[__migrationhistory]
Comments
Post a Comment