entity framework - Get Model schema to programmatically create database using a provider that doesn't support CreateDatabase -


i'm using sqlite provider entity framework 5 doesn't support createdatabase , cannot auto create database. (code first)

is there way can obtain model schema @ runtime can create sql "create table" command myself?

if not @ runtime, other way obtain schema know how create table properly?

thanks!

a) obtaining model schema @ runtime part

(all earlier posts of mine)

see 1 how can read ef dbcontext metadata programmatically?

and how check unit test properties mark computed in orm model?

also 1 custom initializer programmatic data transformation in ef5 code first migration

having said that...

the problem see , @ point have data available.
i'm quite sure won't able @ time.
because able extract info need have dbcontext running - db has constructed etc. etc.

in initializer maybe - using different ways info - above not available.

b) other way go way of implementing provider, generator etc. (e.g. this post).
way should info @ right time ef/cf itself.
haven't played much.

for more info can check ef source code

this more of 'gathered info' far - in case helps anywhere it. not solution. i'll add more tomorrow.

edit:

to real database metadata, other dataspace, should right place...
(note: things tend less exact here - there isn't right official support)

var ssspaceset = objectcontext.metadataworkspace.getitems<entitycontainer>(dataspace.sspace).first()     .baseentitysets     .first(meta => meta.elementtype.name == "yourtablename"); 

if in debugger, table property should have real table name.
however, reflection might required.


how can read ef dbcontext metadata programmatically?
how check unit test properties mark computed in orm model?
programmatic data transformation in ef5 code first migration
entity framework migrationsqlgenerator sqlite
http://entityframework.codeplex.com/
entity framework - table name entity
ef code first: entity table name without dataannotations
get database table name entity framework metadata
http://www.codeproject.com/articles/350135/entity-framework-get-mapped-table-name-from-an-ent


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -