ado.net-entity-data-model

ADO Entity Framework creating unwanted Entity Key

不羁岁月 提交于 2019-12-04 12:37:53
I need to use tables from a DB which I cannot alter (using linked server). So part of my schema is a view on these table and I cannot create an FK in my DB. When I come to creating the association in ADO.NET Entity Framework I am getting problems because a second column on the table from the external DB has an index on it and the EF is creating an Entity Key for it (it's the name descr of the record - I think they just wanted to speed the ordering on it). When I take the Entity Key off this column in the EF entity it complains that I need it because the underlying table has a key on it. If I

ASP.Net Layered app - Share Entity Data Model amongst layers

杀马特。学长 韩版系。学妹 提交于 2019-12-04 04:07:45
问题 How can I share the auto-generated entity data model (generated object classes) amongst all layers of my C# web app whilst only granting query access in the data layer? This uses the typical 3 layer approach: data, business, presentation. My data layer returns an IEnumerable<T> to my business layer, but I cannot return type T to the presentation layer because I do not want the presentation layer to know of the existence of the data layer - which is where the entity framework auto-generated my

Changing the Name of the Connection String that Entity Framework Uses

試著忘記壹切 提交于 2019-12-04 02:02:04
How do you change the name of the connection string that Entity Framework models are bound to by default? Let's say I create an Entity Framework data model named "Model1.edmx" by pointing it to a databased named "MyDb" and picking some objects to map using the Visual Studio add new item wizard. The EF model is in a class library project, so when the wizard completed, it automatically added a connection string named "MyDbEntities" to the App.Config file for the project. My model references this connection string by default. I know I can pass in a connection string to a constructor for my model

What is the meaning of the “Pluralize or singularize generated object names” setting?

半世苍凉 提交于 2019-12-04 01:31:21
When setting up a new Entity data Model, there is an option to [x] Pluralize or singularize generated object names I have noticed this is an option in LINQ as well. Also, now that I am studying the ADO.NET entity framework, I noticed it also has 'DEFAULT' to 'pluralize or singularize generated object names' What is the result of not checking/allowing this option when setting up the 'Entity Data Model'. What Advantages/Disadvantages/issues will I face by making a selection one way or the other? No problem at all, except that you'll probably want to do it manually. Usually, you want entity names

Your project references the latest version of Entity Framework… - Error

心不动则不痛 提交于 2019-12-04 01:11:44
I trying to create an entity data model with Oracle. I am getting this error. I have these installed for my solution. I have also installed ODT for VS 2015. These are my references showing. Web.config <configSections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral,

Do we need DataContract attribute on POCO classes in Ado.net entity Framework 2010

£可爱£侵袭症+ 提交于 2019-12-03 20:58:41
I read somewhere in stackoverflow itself that when we use POCO classes for WCF contracts using Poco generator , we need not use DataContract and DataMember attributes.WCF do it auto for you? . I don't know how it manages this. I created a sample application without using these attributes and I was able to generate those entities on client side and use them. I disabled proxy generation and Lazy loading. Am i missing anything here.? Is there really no need of putting these attributes. You did it right way. Since WCF 3.5 SP1 it is not needed to add DataContract and DataMember attributes. If

References for DBContext, DBSet<> in Entity Framework

送分小仙女□ 提交于 2019-12-03 09:42:01
I am trying to use ADO.Net Codefirst feature of latest Entity Framework 4.0. As part of that I have installed Entity Framework CTP 4 from Microsft and using Scott's tutorial to create the model first. Inside the tutorial DBContext and DBSet<> is specified. Could some tell what is the reference to be used in order to access this class. I have used the following references however nothing happens for DBContext and DBSet<> System.Data.Entity System.Data.Entity.Design Use CTP5 instead it is newer version with some changes in API. You have to add reference to EntityFramework.dll which is installed

Entity Framework Migrations Error - Sequence contains no elements

ⅰ亾dé卋堺 提交于 2019-12-03 09:30:49
command: add-migration blahblah -verbose error: Sequence contains no elements I did a few things before getting this error. I made a change to my code-first model but did not run add-migration yet. Then I added an EDMX model to play around with an idea visually. I realized the EDMX model was messing with my code so I removed it. I tried to run add-migration and got "Sequence contains no elements". I upgraded to EF 5 and uninstalled the old Migrations package except for my configurations. Then I tried add-migration again and I am still getting "Sequence contains no elements". Below is the rest

are model-defined functions still supported in EF6?

风格不统一 提交于 2019-12-01 07:03:34
问题 model-defined functions are discussed here: https://msdn.microsoft.com/en-us/library/vstudio/dd456857(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/dd456812.aspx Entity Framework 6 Code First function mapping http://www.c-sharpcorner.com/UploadFile/ff2f08/model-defined-function/ are these supported by EF6.1.2? I'm stepping through the Edm/DbModel stuff and I can't for the life of me work out where the <Function> element in the csdl is supposed to be parsed, because it's not making

Circular References and WCF

雨燕双飞 提交于 2019-12-01 02:44:01
问题 I have generated my POCO entities using POCO Generator, I have more than 150+ tables in my database. I am sharing POCO entities all across the application layers including the client. I have disabled both LazyLoading and ProxyCreation in my context.I am using WCF on top of my data access and business layer. Now, When I return a poco entity to my client, I get an error saying " Underlying connection was closed" I enabled WCF tracing and found the exact error : Contains cycles and cannot be