ado.net-entity-data-model

there is no ado.net entity data model in visual studio [duplicate]

回眸只為那壹抹淺笑 提交于 2019-11-30 17:00:34
This question already has an answer here: Missing “Ado.Net Entity Data Model” on Visual Studio 2013 9 answers After installed Visual Studio 2013 and create a new MVC4 internet application project : Visual Studio Doesn't have Ado.net Entity Data Model when i click on add->new item-> Why? I reinstall it but ther is no change ... uncleGe Here's an updated solution I found as I had the same problem with Visual Studio 2015: ado.net model for db is gone Visual studio 2015 Paraphrasing: Change your installation of Visual Studio 2015 and include the Microsoft SQL Server Data Tools (via Control Panel >

Can SQL Server views have primary and foreign keys?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 15:04:36
问题 Is it possible to define primary and foreign keys for database Views in Microsoft SQL Server Management Studio? How? I'm trying to create an ADO.NET Entity Data Model to read from four old, poorly-formed database tables that I cannot modify. I've created views of just the data I need. The four views should map to a simple three-entity EDMX with one many-to-many relationship. I get this error when creating my Data Model: The table/view '...' does not have a primary key defined and no valid

How can you dynamically select a table with entity framework 4.x?

女生的网名这么多〃 提交于 2019-11-30 14:48:47
Suppose I have a database named MyDatabase which has two tables - MyTable1 and MyTable2 . Using the Code First approach with Entity Framework 4.x and .NET 4, I have generated a context named MyDatabaseContext which contains MyTable1s and MyTable2s . Normally, tables are accessed like MyDatabaseContext.Table1s.<Command> . In my database many tables share a couple of common fields (e.g. CreatedOn, ModifiedOn). I would like to to be able to dynamically substitute a table name so I can execute the same query against any table. What I really want (and which does not seem to be available) is

Can SQL Server views have primary and foreign keys?

≯℡__Kan透↙ 提交于 2019-11-30 13:02:19
Is it possible to define primary and foreign keys for database Views in Microsoft SQL Server Management Studio? How? I'm trying to create an ADO.NET Entity Data Model to read from four old, poorly-formed database tables that I cannot modify. I've created views of just the data I need. The four views should map to a simple three-entity EDMX with one many-to-many relationship. I get this error when creating my Data Model: The table/view '...' does not have a primary key defined and no valid primary key could be inferred. This table/view has been excluded. To use the entity you will need to

ADO.NET Entity Connection String for Multiple Projects

青春壹個敷衍的年華 提交于 2019-11-30 05:52:26
I am using multiple layer project where the DataModel hosts the ADo.NET Entity model and DataAccess layer does the validation. However everytime I get a error like this The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid. I have tried connection strings <add name="SalesEntities" connectionString="metadata=res://*/SalesEntities.csdl|res://*/SalesEntities.ssdl|res://*/SalesEntities.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.;Initial Catalog=Phoenix;Integrated Security=True

there is no ado.net entity data model in visual studio [duplicate]

我的未来我决定 提交于 2019-11-30 00:20:11
问题 This question already has answers here : Missing “Ado.Net Entity Data Model” on Visual Studio 2013 (9 answers) Closed 3 years ago . After installed Visual Studio 2013 and create a new MVC4 internet application project : Visual Studio Doesn't have Ado.net Entity Data Model when i click on add->new item-> Why? I reinstall it but ther is no change ... 回答1: Here's an updated solution I found as I had the same problem with Visual Studio 2015: ado.net model for db is gone Visual studio 2015

How can you dynamically select a table with entity framework 4.x?

拟墨画扇 提交于 2019-11-29 22:13:26
问题 Suppose I have a database named MyDatabase which has two tables - MyTable1 and MyTable2 . Using the Code First approach with Entity Framework 4.x and .NET 4, I have generated a context named MyDatabaseContext which contains MyTable1s and MyTable2s . Normally, tables are accessed like MyDatabaseContext.Table1s.<Command> . In my database many tables share a couple of common fields (e.g. CreatedOn, ModifiedOn). I would like to to be able to dynamically substitute a table name so I can execute

How can I add constraints to an ADO.NET Entity?

半城伤御伤魂 提交于 2019-11-29 10:25:32
I know how to mark a group of fields as primary key in ADO.NET entities but i haven't found a way to declare unique constraints or check constraints. Is this feature missing on the designer or on the framework? Support for unique keys/constraints does not exist in ADO.NET Entities in v4.0, see the answer to " one-to-one association on a foreign key with unique constraint ", where Diego B Vega says: I know for sure we haven't added support for unique keys other than primary keys in 4.0. He does, however, provide a possible workaround/hack (which comes with all the normal caveats): As you are

ADO.NET Entity Connection String for Multiple Projects

狂风中的少年 提交于 2019-11-29 05:06:39
问题 I am using multiple layer project where the DataModel hosts the ADo.NET Entity model and DataAccess layer does the validation. However everytime I get a error like this The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid. I have tried connection strings <add name="SalesEntities" connectionString="metadata=res://*/SalesEntities.csdl|res://*/SalesEntities.ssdl|res://*/SalesEntities.msl;provider=System.Data

getting identity row value using ADO.NET Entity

不想你离开。 提交于 2019-11-28 11:20:24
问题 I have the following table in SQL Server 2008 database: User -------------------------------------------------------- Id Numeric(18, 0) | Identity(1, 1) PK not null Name Nchar(20) | Not null I'm using an ADO.NET Entity Data model to do: MyEntities entities; try { entities = new MyEntities(); if (entities.User.Count(u => u.Name == userName) == 0) { entities.User.AddObject(new User() { Name = userName }); resultCode = 1; entities.SaveChanges(); } else { resultCode = 2; } } catch { resultCode =