V
V
VanArcher2016-08-02 05:31:16
C++ / C#
VanArcher, 2016-08-02 05:31:16

Why is an empty *edmx file generated?

Uses SQL Server Express version of LocalDB; Microsoft visual studio community.
Created a database with a table and a solution based on the console application template.
There are three columns in the table: the first is id(int), the second is Section_Number(nvarchar(50)), the third is Section_Text(nvarchar(MAX)). The table is without rows.
In the solution, when an ADO.NET EDM element is added, the corresponding "connection" is formed, in which the database and data of the table created with saving the connection settings in the app.config file are selected.
The names in the entity form constructor change slightly: Section_number -> Number, Section_text ->Text.
After that, the application is compiled to form three *.csdl, *.msl and *.ssdl files.
*edmx contains the *designer.cs file, it remains empty (it is recommended to update the data from the database in the designer, it does not help), that is, three *.csdl, *.msl and *.ssdl files are not created.
It is not clear what this problem can be connected with, since in the designer the table entity is correctly displayed and the data included in it.
As a result, when working with EF with the database, it is impossible to use the methods: .AddObject(); .CreateQuery() etc. -
there is only .add(); .sqlcreate() etc.
Please tell me how can I fix this problem?
I carry out the actions according to the book: "Andrew Troelsen - The C# 5.0 Programming Language and the .NET 4.5 Platform (The Expert's Voice in .NET) - 2013" - the actions were carried out according to those described on pages: 758-760; 859-864 and 870-871.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2016-08-02
@VanArcher

It looks like you have an EF4 book (there was an AddObject method) and EF6 is installed. Read the manuals for the new version - it is better in all respects. You can forget about *.csdl files and others like them - EF6 works best with the description of the database in the form of C# classes (Code First From Database).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question