Not sure what the EDMGEN is validating here
It validates the ssdl file against a live database schema looking for inconsistencies)?
Ot it only validates the internal consistency between the ssdl, csdl and msl files?
If nobody has changed manually the contents of the autogenerated ssdl, csdl and msl files is there any reason to validate them?
Is this validation the same that runs when "Validate On Build" property of the ConceptualEntityModel is set to true in visual studio?
Is there any way to check consistency between ssdl file and live database? (like new tables, diferents fields, foreign keys, etc...) A similar results like the ones provided by Redgate SQLCompare when comparing schemas...
Ot it only validates the internal consistency between the ssdl, csdl and msl files?
It validates only EDMX file - it means consistency between SSDL, MSL and CSDL.
Is this validation the same that runs when "Validate On Build" property of the ConceptualEntityModel is set to true in visual studio?
Yes
Is there any way to check consistency between ssdl file and live database?
That is not purpose of EDMGEN validation or entity framework. If you have VS Premium or Ultimate edition you can use its database tools to compare two databases - that is mostly equivalent to RedGate's SQL Compare. I'm not sure if there is any tool to compare SSDL and the real database but what you usually only need is set of your integration tests which will validate that your database still works with your model.
Related
Is there a way to use my existing EDMX and connect to PostgreSQL ?
Also can I convert MSSql edmx to work with postges, coverting edmx to edmi is also an option?
Thanks
Is there a way to use my existing EDMX and connect to PostgreSQL ?
The only option is to remove the current connection string from the config file of the application. After that, when running any of the wizards in the EDM Designer, the dialog box for choosing/creating the connection will be shown first.
Also can I convert MSSql edmx to work with postges, coverting edmx to edmi is also an option?
Yes, it is available. You can open an *.edmx file in Entity Developer and save it as *.edml for further work. After you have converted your model you can change the connection being used to the necessary one (open Database Explorer, right-click the Database Connection and select Edit Connection Properties from the shortcut menu).
JIC: dotConnect for PostgreSQL Professional should be installed.
Entity Developer has a lot of improvements comparing to EDM Wizard (*.edmx, the ADO.NET Entity Data Model item):
Visual editing of the storage part of the model
Embedded T4 Editor for customizing templates: http://www.devart.com/entitydeveloper/code-generation.html
Handy EF Code First DbContext Template: http://blogs.devart.com/dotconnect/entity-developer-ef-code-first-dbcontext-template.html
Splitting a model into diagrams to improve its readability: http://blogs.devart.com/dotconnect/working-with-large-models-and-oracle-autoincrement-fields-in-new-version-of-entity-developer.html
Data viewing/editing: http://www.devart.com/entitydeveloper/data.html
Visual enhancements: http://blogs.devart.com/dotconnect/visual-enhancements-in-entity-developer-4-1.html
All advanced Entity Developer functionality is available in all supported Visual Studio versions: 2008 - 2013
The possibility of configuring data type mapping using Database-First approach
Wide range of settings for naming rules for model objects
The possibility to enable the synchronization of mapping and storage parts when editing the conceptual part
Please refer to http://www.devart.com/entitydeveloper/ed-vs-edm.html
I'm using a database-first process. I've got hundreds of tables imported into my EDMX and generated CUD procs imported as well. The generated CUD procs use a naming convention based on the table name and he CUD operation.
How can I write some code to open the EDMX, associate the CUD procs with the proper entities, and save the EDMX?
This is a lazy-developer, design-time task - this will not be happening at runtime.
Well, what I wanted was a free library which contained the object-model representation of the EDMX. This would allow developers to edmx.Load(pathToEdmx), query the object-model, make changes, and edmx.Save(). Apparently, such a library doesn't exist.
So, I wrote some code to load the XML, query the XML, make some changes, and save. Not as rich as an object-model with validation and helpful exceptions (and very prone to typos), but it worked.
Setup
I have a SQL Server 2008 database that is accessed using the Entity Framework on the server.
Each client has a SQL Server Compact Edition 3.5 database for storing data when offline.
I use self tracking entities that are generated from the server defined Entity Framework.
Question
At the moment i have two EDMX defined, one for the server and another for the client, even though they are identical except for the storage provider. I use the self tracking entities from the server and they work fine with the client database. Is there a way to have just a single EDMX? At the moment there is a risk I will make a change to one EDMX and forget to make it to the other. Or am I using the wrong approach?
Note
I do not want to use the sync framework because of complex business logic that needs applying at the server side.
Unfortunately there is no direct way to use single EDMX with multiple storage providers. You must always have separate SSDL part for each provider. The common workaround is to export SSDL, MSL and CSDL as separate files (default setting adds them as resources to assembly) and use some script or pre-build action to create copy of SSDL file with all necessary changes for second provider (there can be also different data types between SQL Server and SQL Server CE). You will than use correct SSDL file per application by specifying it in connection string.
Another "better" solution is not using EDMX and use code first where this problem mostly doesn't exist - but that is architecture change.
I'm trying to kick off a project needing table-per-hierachy. I've done this in the past with NHibernate, but we want to avoid having to hand edit XML mapping files - so are trying to use Entity Framework and it's Designer.
I've been following this example online:
http://mosesofegypt.net/post/Inheritance-and-Associations-with-Entity-Framework-Part-1.aspx
When trying to select a Table from the "<Add Table or View>" dropdown, I can't select any tables, instead the list shows "(Empty)".
The only deviation I've made from the tutorial is that I didn't generate the Person table off the sample database, as far as I can tell this shouldn't make a difference (we want to generate the DB off the model, not vice versa).
Not sure what criteria a table needs to meet to be eligible to add a discriminator to...
If you need to generate DB from the model you cannot see any table in mapping because both mapping and information about tables is generated when you generate the database. EDMX has quite complex structure (much more complex than very easy hbm files for NHibernate). The complexity is even worse because EDMX doesn't have anything implicit - everything must be described and it must be described three times.
EDMX consists of three parts:
CSDL - conceptual model you see in the designer (classes)
SSDL - database description - this can be browsed in model browser but it is read-only
MSL - mapping between SSDL and MSL (that is what you are trying to edit in that window).
When you are going to use model-first (draw entities in designer and generate database) you define only CSDL and everything else is generated with SQL for the database. You will also probably need another template / workflow for DB generation because I guess it will by default use Table-per-type inheritance. Check Database generation power pack - it should contain template for TPH.
What is the purpose of .edmx files? Reading the CSDL, SSDL, and MSL specifications, it looks to me like .edmx files are used only at design time. Are we meant to distribute it with the other edmx? It seems like we need to distribute the .ssdl and/or .csdl files instead.
EDMX is Visual Studio's "container" for all things about your Entity Data Model.
It contains all the information that is in the CSDL, SSDL, MSL, plus information about the visual layout of the tables in your Visual Studio designer surface.
The EDMX file is converted into CSDL, SSDL, MSL (typically embedded as resources in your assembly) during the build process. You definitely don't have to distribute or copy the EDMX files anywhere for the app to run.
Update: if you are more interested in a code-based approach, you should check out the code-first CTP for Entity Framework which gets by without any .edmx, .csdl/ssdl/msl files at all.
An .edmx fileis an XML file that defines a conceptual model , a storage model, and the mapping between these models. An.edmx file also contains information that is used by the ADO.NET Entity Data Model Designer (Entity Designer) to render a model graphically.