ADO.NET EDMX file is corrupt but XML is valid - edmx

I've been working on a model the last days in ADO.NET Entity Data Model Designer.
I'm not sure what action I did in the designer but suddenly the window of the designer looked weird, jumped to the left and seemed corrupt. So I closed the file in the hope that re-opening would result in the diagram to show up again.
Instead I got the error: The Entity Data Model Designer is unable to display the file you requested. You can edit the model using the XML editor.
When I edit the XML it seems all fine. The only 'warnings' I get are 11007 and 11008 about associations and entity types not being mapped. And that is correct, I'm just designing the model for now. In the past I created a little windows program that reads the XML and makes a HTML/Word document out of it. When I run that tool the output seems perfectly fine.
I tried to remove the last added table and associations from the XML but no luck.
I also tried to open the file in a newer visual studio (2022), also same error. I'm currently using VS2019 with the entity framework 6 tools.
Also when I create a new EDMX file with some entities and associations it works fine and it displays the diagram. I don't see anything different in the structure from a new file and my corrupt file.
There are 57 entity types with their associations. Not sure how I'm going to be able to verify everything in the file manually. It would be nice to have some tool that I can use to generate or validate the model and to see some error on where the problem might be.
Is there a way to find the issue that the designer trips over?

Related

How to properly setup a MYSQL database with JAVAFX intellij?

Ok so Im am still very new to javafx and intellij. I am working on a little project of my own right now and all I am trying to build is a simple calendar just like apple's version or google's. I figured this would be a good exercise for me to get to know the Intellij IDE better and JavaFX.
Here is the problem that I seem to be stuck with for a couple days now. In my application, a user has the ability to create a new event which contains many properties such as "event name", "first name", "last name" etc.. Now all the information is stored in a shall we call it "NewEvent" Node. Here lies the problem I am facing. I am trying to save the data locally on the clients computer however I am not sure how to begin. I have browsed around and I have found this thing called MYSQL that is supposed to do just that. I was hoping you guys could help me out here on how I should set this up.
Here is what I've done so far.
Downloaded MYSQL v5.7
Downloaded MYSQLWorkbench
Created a Database called "event" with all the properties contained in the Node
Somehow added the MYSQL database to intellij
Created a dialog where if the user clicks save, all the information is stored in a node.
To my understanding in order to access the data stored in the MYSQL table, shouldnt the "data file" be saved in my project folder? I have no clue where this is located. Also how would I gain access to database in order to edit it dynamically. Like adding a new row to the database.
I have looked up online with many different searches but they all seem to be using NetBeans and they are mostly outdated. I found it really hard to find information from start to finish. All I want to do is to store data locally and to access it. I expect to have a largely populated database, seeing as no one actually deletes an event once its over so what I was told is that MYSQL is capable of handling huge data. Hence my choice to go along with it.
I have done a little Android Application last summer so I am a little familiar with MYSQL, however I remember saving the data onto a table on the clients phone.
MySQL isn't an embedded database. Only the libmysqld is embeddable.
You can integrate JavaFx application with any database. HSQLDB or H2 would be more appropriate, since they do not need an installation on the client machine, and can be configured to save the data file on any location.

Generate Core Data Sqlite Database on Server

I have an iPad app that uses Core Data with Sqlite. I keep getting errors when a save is called on the managedobjectcontext. The error is sql error (19) constraint fails. I found a few websites that lead me to modify my generation code and update the Z_MAX field in the table Z_PRIMARYKEY table. Are there any other things that Core Data does behind the scenes similar to this?
Note: Yes, I know I shouldn't be doing this but part of the problem is the core data database is over 5 MB and it takes a long time to process the data from a plist. (Maybe JSON would be faster?)
EDIT I just noticed Z_ENT which is the entity id. I have to add that into the generation as well.
EDIT 2 Go the Entities mapped but I'm still getting the error. It is having trouble doing deletes and updates even through it appears to be valid.
Appeared to just be an issue with the app itself.

can't create jpa tables in eclipse

I had a working project in eclipse which created a JPA table from entity to mysql database (still learning). Unfortunately it made the table in the wrong database as I wanted there to be 'test' and 'production' databases. Somehow it got the details for the 'production' db, even that it looked like the selected database connection was for the test.
I tampered with the project a bit and made it to connect with right connection object for certain (test). I can ping the db in eclipse (both dbs) and see the db in the Data Source Explorer.
But now I can not create the table(s) for the project by right clicking on it and selecting 'JPA 'Tools' > 'Generate Tables from Entities'.
The creation starts and finishes with no errors, like everything works, yet I see no tables in either of the databases. (In eclipse Database explorer or from command line).
The persistence.xml should be fine as it already created that one table before.
The only error is for the Entity class as it says for the Entity annotation "Table xxx cannot be resolved". And as I see, it's coming from the table not being created.
Here's the persistence.xml just in case.
http://pastebin.com/djPZei90
The project is also a Maven project and it uses SVN. The dependencies were successfully loaded by the maven for the eclipse/project and there is no complications with the SVN.
Because of Maven there are 2 persistence.xml files (only the login credentials and the database name changes), for production and test. It could be that the db-connection was checked and loaded from the wrong file at the 1st place. (just guessing)
Also I tried to create the script.sql when generating the table(s). I found the file but it was completely empty.
Anyway the problem is now that I can't create the tables anywhere.
I am totally puzzled by this. Any hints where I should look to fix this?
Chris had it right, even that I didn't understand the answer correctly at the first reading.
I tried with the other provider, but I may had modified the wrong file by accident (2 'persistence.xml' files as it's a maven project), or there may have been some other reason I failed to spot.
I was given a hint earlier, that I should use the given provider (in persitence.xml). Causing that I didn't pay too much attention to it after all. Since using eclipselink, the provider has to be indeed:
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
Thanks again Chris, even that I failed at the first attempt and had to spend several more hours on resolving this.
Could you solve the problem? Unfortunately I have stumbled on the same rare issue, which totally makes no sense. The JPA Tools just doesn't add the mapping classes for whatever reason, although it writes them into the persistence.xml.
Previous week everything worked flawlessly but now everything is f**. I even created a new independent project in different workspace but it happens the same bug. Obviously it's an eclipse/plugin bug, otherwise I can't explain it. Working with eclipse 4.2.0. I am not happy.
Edit: After removing Dali Tools, JPA Configurator, Seam 3 Plugin creating entities seems to work again. Don't know why, most likely a conflict, but it still doesn't explain why it happened now and not 1 month ago. I didn't change my eclipse install at all since then...
Spend the whole day on this.
I created a completely new (JPA) project in Eclipse (Indigo btw).
Also created a new database (mysql) for that.
Made a connection in Eclipse for that. File > New > Other... > Connection Profile.
Made a new package structure and let the Eclipse create the 'persistence.xml' (src/META-INF/persistence.xml).
I made an 'JPA Entity' class with eclipse wizard. (added 'id' (PK) and 'content' fields)
Copied the 'pom.xml' from my previous project to the new one (made only minor changes like the project name).
Also copied the 'persistence.xml' file from the previous project (src/main/java/META-INF/, no 'test' included). Changed database details and login credentials from the persistence file.
Made the project 'Maven project' in eclipse (right click on project name > Configure)
As it was now a Maven project the default 'persistence.xml' could be removed as it was in wrong place. (Mavenizing the project removed all the errors from un-existing jars with the pom.xml)
Tried to create the table again for the project (Same error, but wait...).
Right clicked on project > Maven > Disable Maven Nature
Then again made it maven project, right clicked on project > Configure > ...
Tried creating the tables again and it created them. Everything works!
Go figure!
Seems like everything was ok, like I suspected. There seems to be some sort of bug with maven (plugin) + eclipse.
Doing the same tricks on the previous project won't help. I even created the entity class with the wizard (removed the existing). The <class> declaration is added to the 'persistence.xml', but it still wont do the table. (Also tried removing and re-adding the maven nature)
I could be missing something on the process/did it differently or doing it wrong whole together. But considering I get the other project work while other doesn't, using the same tricks, there seems to be a big nasty bug.

Connection string not found when trying to query database under SubSonic

I get this error no matter what version of SubSonic I use. When I query the database for data, it errors out, saying it can not connect to the database.
However, it is able to generate the .cs classes(ActiveRecord, Context, etc) when told to do so.
Any help is appreciated.
Thanks folks...
My guess is that you have your SubSonic generated classes in a separate project from where your main application is (in another project in the same solution). Your main application project references the project containg the SubSonic generated classes.
If this is the case, your main application project must also contain the connection string in a config file, similarly to what your other project has. You might also need to copy over some of the other SubSonic related items from your other project's config file as well.

Linqtosql sync with the database

I am about to use linqtosql in my first asp.net mvc application.
I have come up with a database schema. But the problem is that I may change few of the tables in future. So keeping the model classes in sync with database will be a issue.
I got this link which states the similar situation,
keep LinqToSQL sync with the database
My question is, has any body used the third party tools given in the above post,
do they work properly
www.huagati.com/dbmltools/
www.perpetuumsoft.com/Product.aspx?lang=en&pid=55&tid=linqtosqlsynchronization
Or is there any better approach for this problem.
The "official" approach is to simply delete any out of date tables from the designer then drag the updated table from your Server Navigator back on again. I've been using this method for well over a year now and so long as you make your data context changes at the same time you're updating the database you should be OK. It also gives you extra incentive to make sure you have your database structure in order before continuing.
There is also SQLMetal.
http://msdn.microsoft.com/en-us/library/bb386987.aspx
This is whats in our CreateDBML.bat file
call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
sqlmetal /server:{server-name} /user:{username} /password:{password} /database:{databasename}
/dbml:..\..\Codebase\Domain\CompanyName.ProjectName.Domain\Entities\ProjectName.dbml
/namespace:CompanyName.ProjectName.Domain.Entities /pluralize /views
sqlmetal /code:..\..\Codebase\Domain\CompanyName.ProjectName.Domain\Entities\ProjectName.designer.cs ..\..\Codebase\Domain\CompanyName.ProjectName.Domain\Entities\ProjectName.dbml
pause