Search Results

Search found 43366 results on 1735 pages for 'entity attribute value'.

Page 18/1735 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Entity framework MappingException: The type 'XXX has been mapped more than once

    - by Michal
    Hi everyone, I'm using Entity framework in web application. ObjectContext is created per request (using HttpContext), hereby code: string ocKey = "ocm_" + HttpContext.Current.GetHashCode().ToString(); if (!HttpContext.Current.Items.Contains(ocKey)) { HttpContext.Current.Items.Add(ocKey, new ElevationEntityModel(EFConnectionString)); } _eem = HttpContext.Current.Items[ocKey] as ElevationEntityModel; Not every time, but sometimes I have this exception: System.Data.MappingException was unhandled by user code Message=The type 'XXX' has been mapped more than once. Source=System.Data.Entity I'm absolutely confused and I don't have any idea what can caused this problem. Can anybody help me? Thanks.

    Read the article

  • ADO.NET Entity Framework with OLE DB Access Data Source

    - by Tim Long
    Has anyone found a way to make the ADO.NET Entity Framework work with OLE DB or ODBC data sources? Specifically, I need to work with an Access database that for various reasons can't be upsized to SQL. This MSDN page says: The .NET Framework includes ADO.NET providers for direct access to Microsoft SQL Server (including Entity Framework support), and for indirect access to other databases with ODBC and OLE DB drivers (see .NET Framework Data Providers). For direct access to other databases, many third-party providers are available as shown below. The reference to "indirect access to other databases" is tantalising but I confess that I am hopelessly confused by all the different names for data access technology.

    Read the article

  • Repository Pattern with Entity Framework 3.5

    - by Ravi
    I am developing a Database File System. I am using - .Net framework 3.5 Entity Framework 3.5 WPF with MVVM pattern The project spans across multiple assemblies each using same model. One assembly,let's call it a "server", only adds data to the database using EF i.e. same model.Other assemblies (including the UI) both reads and writes the data.The changes made by server should immediately reflect in other assemblies. The database contains self referencing tables where each entity can have single OR no parent and (may be) some children. I want to use repository pattern which can also provide some mechanism to handle this hierarchical nature. I have already done reading on this on Code Project. It shares the same context(entities) everywhere. My question is - Should I share the same context everywhere? What are the advantages and disadvantages of doing that?

    Read the article

  • Repository Pattern with Entity Framework 3.5

    - by Ravi
    I am developing a Database File System. I am using - .Net framework 3.5 Entity Framework 3.5 WPF with MVVM pattern The project spans across multiple assemblies each using same model. One assembly,let's call it a "server", only adds data to the database using EF i.e. same model.Other assemblies (including the UI) both reads and writes the data.The changes made by server should immediately reflect in other assemblies. The database contains self referencing tables where each entity can have single OR no parent and (may be) some children. I want to use repository pattern which can also provide some mechanism to handle this hierarchical nature. I have already done reading on this on Code Project. It shares the same context(entities) everywhere. My question is - Should I share the same context everywhere? What are the advantages and disadvantages of doing that?

    Read the article

  • Entity framework createquery question.

    - by Tony Heflin
    I am trying to create a generic search form to use in an EF app. I want to be ably to specify the entity to query at runtime below is a simplified version of the code. cx is the contect object, valuelists is the entity in question. 1: Dim q As String = "select c from intactentities.valuelists as c" 2: Dim x = cx.CreateQuery(Of ValueLists)(q) 3: TextBox1.Text = x.Count This works but I need to remove the hardcoded reference to valuelists in line 3. I expect I am overlooking something simple can anyone suggest a simple solution? Thanks Tony

    Read the article

  • insert and modify a record in an entity using Core Data

    - by aminfar
    I tried to find the answer of my question on the internet, but I could not. I have a simple entity in Core data that has a Value attribute (that is integer) and a Date attribute. I want to define two methods in my .m file. First method is the ADD method. It takes two arguments: an integer value (entered by user in UI) and a date (current date by default). and then insert a record into the entity based on the arguments. Second method is like an increment method. It uses the Date as a key to find a record and then increment the integer value of that record. I don't know how to write these methods. (assume that we have an Array Controller for the table in the xib file)

    Read the article

  • Using Repository and Unit of Work patterns with Entity Framework 4.0 and MVC 2

    - by Mr. D
    Hi, I'm following this article Using Repository and Unit of Work patterns with Entity Framework 4.0. I'm tying to implement the Repository and Unit of work pattern, using Asp.Net MVC 2 and Entity Framework 4. Please let me know if I'm doing it right... In the Models folder: Northwind.edmx Products.cs (POCO class) ProductRepository.cs (Did my product query) IProductRepository.cs NorthwindContext.cs IUnitOfWork.cs In the Controller folder: ProductController.cs (Retrieve from ProductRepository.cs and Pass it to the view) When I run the application, I'm getting error message: Mapping and metadata information could not be found for EntityType 'NorthwindMvcPoco.Models.Category'. I don't know what I'm doing wrong. I search through whole web and I couldn't resolve this issue. Please help me.

    Read the article

  • Generating Entity Keys

    - by David Veeneman
    I have run into my first dissapointment with Entity Framework 4. It turns out that SQL CE, when used with EF4, does not support autogenerated primary keys. I get a System.Data.UpdateException from OnjectContext.SaveChanges() with this message: Server-generated keys and server-generated values are not supported by SQL Server Compact. So, now I have to manually generate keys for my entities. Assuming I want to use auto-incremented integer keys, what is the best way to go about generating and keeping track of the keys when using Entity Framework? Thanks for your help.

    Read the article

  • Entity Framework - Medium Trust

    - by Echilon
    I'm trying to get the entity framework working in medium trust. I've tried splitting the files and using a separate assembly but I seem to have one problem after another. I moved the EDMX to a separate assembly, which causes a single .dll to be outpit to the sites /Bin directory. I'm referencing this as below from web.config. Whenever I try to access one of the entity classes, I get an ArgumentException: 'An item with the same key has already been added.' It's critical this works with medium trust, but I seem to be running out of options. Any advice greatly appreciated.

    Read the article

  • Entity Frameworks 4 - Changing the model does not update the T4 self tracking template files

    - by Darren
    I am using self tracking entities and have moved the entity classes to another assembly by using 'Add as link' to point to the TT file as mentioned here. Now though, when I update the model (for instance change a property name) the template is not automatically run and so the entity class does not get updated. I can of course manually run the template to get the updates, but it would be easier if it ran automatically in the way it did before I moved the classes. Is there any way to achieve this? Darren.

    Read the article

  • insert and mofigy a record in an entity using Core Data

    - by aminfar
    I tried to find the answer of my question on the internet, but I could not. I have a simple entity in Core data that has a Value attribute (that is integer) and a Date attribute. I want to define two methods in my .m file. First method is the ADD method. It takes two arguments: an integer value (entered by user in UI) and a date (current date by default). and then insert a record into the entity based on the arguments. Second method is like an increment method. It uses the Date as a key to find a record and then increment the integer value of that record. I don't know how to write these methods. (assume that we have an Array Controller for the table in the xib file)

    Read the article

  • Entity Framework + SQLite deployment

    - by Pompair
    Hi, I have a ASP.NET MVC app that is using SQLite database through Entity Framework. Everything works on VS 2008's local development webserver. However, deploying the web app to my service provider causes this error: [ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.] System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +1308959 System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +35 Service provider has commented that they do not support SQLite. I had though that SQLite is independent of service provider's settings since it's App_Data deployable. Has anyone experiences of a succesfull Entity Framework + SQLite deployment? Cheers, -pom-

    Read the article

  • Generate Entity Data Model from Data Contract

    - by CSmooth.net
    I would like to find a fast way to convert a Data Contract to a Entity Data Model. Consider the following Data Contract: [DataContract] class PigeonHouse { [DataMember] public string housename; [DataMember] public List<Pigeon> pigeons; } [DataContract] class Pigeon { [DataMember] public string name; [DataMember] public int numberOfWings; [DataMember] public int age; } Is there an easy way to create an ADO.NET Entity Data Model from this code?

    Read the article

  • Entity Framework Performance Problem

    - by Steve Horn
    I'm hoping that someone can help me understand how to overcome a performance problem I'm running into with the latest version of the Entity Framework. In my test, I created my model from a database consisting of around 80 tables. The problem that I'm running into is that the cost of the very first query I run on a thread is very expensive. If I run without pre-compiling views the first query takes anywhere from 5800 to 6600 milliseconds. If I pre-compile the views (see this article) I can get the initial query cost down to about 2800 to 3200 milliseconds. 3 seconds for each request is still unacceptable for my needs. Subsequent queries are very fast. Can you please help me understand how to eliminate the poor performance of the initial query? I'm using the version of entity framework that ships with Visual Studio 2010 RC.

    Read the article

  • There is no Key attribute in EF CTP 5

    - by Spence
    According to the blog post here Data Annotations in the Entity Framework there should be an attribute for a column called "Key" which allows you to mark the primary key of an entity. However I cannot locate this in .Net 3.5 or .Net 4.0. What have I missed? I've included the reference to EntityFramework.dll and I've checked all the attributes under System.ComponentModel.DataAnnotations but I cannot locate it. I have set my project to .Net 4.0 full (not client profile). Any ideas?

    Read the article

  • VS2010 MVC and Entity Framework Model in Separate Project

    - by mdm
    Hi, I am trying to use an Entity Framework Model (in separate project) into an asp.net 4 MVC project (VS2010, C#) If I create the EF inside the MVC project I have no problems. I think I am missing some step. things done: 1. added reference to the EF class project 2. added connection string in MVC web.config 3. added reference to System.Data.Entity in both web.config and project references Now i can use the model only if I copy the .edmx file to the Models folder, but in this way the EF project is not external anymore. What am I missing? Thank you in advance.

    Read the article

  • [Java] Form data transition into entity beans to persist them by the server side ORM

    - by cscsaba242
    Hello guys, Is there any good explanation or tutorial which describes the common way how can we create entity beans from the received data of the form ? The main reason of my question the treating the received ids (e.g id of country,city and so forth) which is the way from the id to entity ? Example: ................Client side form username:String countryid:Integer (could be a drop down) ................Server side entities public class UserBean { String username; CountryBean Country; } public class CountryBean { String cityname; Integer id; } ............................................ Maybe the question is dependent of the used technology, but I guess there is a very common way. I would like to comprehend the conventional approach of this problem. (For the sake of the completeness I would like to save the form data (received by Stripes) by JPA) Thanks advance. cscsaba242

    Read the article

  • ADO.NET Entity Model and LINQ

    - by Richard
    Hi all I'm using an ADO.NET Entity Model which I'm trying to query using LINQ. The problem I'm having is that I can't specify the where clause as I'd like. For instance, consider the following query: AccountsDM db = new AccountsDM(ConfigurationManager.ConnectionStrings["PrimaryEF"].ConnectionString); var accounts = from a in db.Accounts select a; foreach (var account in accounts) { foreach (var ident in account.Identifiers) { if (ident.Identifier == identifier) { // ident.Identifier is what I'd like to be filtering in the WHERE clause below } } } Ideally, I'd like that to become: var accounts = from a in db.Accounts where a.Identifiers.Identifier == identifier select a; I'm guessing I've probably not set up my Entity Model correctly in VS2010. Any advice you can offer would be gratefully received. Thanks, Richard.

    Read the article

  • Entity framework - exclude list of values

    - by DutrowLLC
    Is there a way to exclude a list of values for an object attribute when querying the database through entity framework? I tried to be slick and pull this number: List<String> StringList = new List<String>(); StringList.Add("ya_mama"); StringList.Add("has"); StringList.Add("fleas"); servicesEntities context = new servicesEntities(); var NoFleasQuery = (from x in context.person where !StringList.Any(y => y.CompareTo(x.the_string_I_dont_want_it_to_be) == 0) // <--- the part where I thought I was slick select x); ...it compiled, but after I ran it, it gave me this error: Unable to create a constant value of type 'Closure type'. Only primitive types ('such as Int32, String, and Guid') are supported in this context. 'Closure type'???? How about MY closure!!! Entity framework... you broke my heart.

    Read the article

  • Entity Framework use of indexes and foreign keys

    - by David
    I want to be able to search a table quite quickly using the Entity Framework, say if I have a Contacts table, a JobsToDo table and a matrix table linking the two tables e.g Contacts_JobsToDo_Mtx and I specify two foreign keys in the Contacts_JobsToDo_Mtx table, if I wanted to search this Mtx table, do I need to specify an index on the two foreign keys? Or by the fact that they are two foreign keys are they considered indexed on them anyway? Will the Entity Framework be able to search through the Mtx table quickly without having to specfiy an index on both keys? Thanks!

    Read the article

  • Need Help on entity framework

    - by Sarathi1904
    I have 3 tables(Roles,Actions and RoleActionLinks). Roles table has few columns(RoleID,RoleName,Desc). Actions table has few colums(ActionID,ActionName,Desc). In RoleActionLink is created for store the association between Roles and Actions and this table has the columns such as RoleID,ActionID When I created the data model(edmx). it shows only Role and Action as entity. i did not find RoleActionLink table. but even there is no direct relation between Roles and Actions table, both tables are automatically related using RoleActionLink table. When i create the new Action, a action record should be populated in Action table(this is works fine). At the same time, i need to populate record in RoleActionLinks table. But i dont have the entity to populate. Please tell me how to accomplish my needs.

    Read the article

  • Entity Fremework serialization

    - by Alexandr
    Hello guys! I was confused with my problem. I'm using Entity Framework and want to save entities on hard disk and then to restore them. I have no problem with Serializing/Deserializing but i get an exception "The object cannot be added to the ObjectStateManager because it already has an EntityKey. Use ObjectContext.Attach to attach an object that has an existing key" when i try to add deserialized object to my datacontext. And nothing happens when i just Attach my entity to datacontext How to achieve my goal? Thx in advance! -Alexandr-

    Read the article

  • EF Code First Detached Entity not updating object reference

    - by Alvaro
    I'm posting the exact entity: public class Person : ContactableEntity { public Plan Plan { get; set; } public int Record { get; set; } public int PersonTypeValue { get; set; } } I'm using the following code to update in a disconected context fashion: public void Update(DbSet MySet, object Obj) { MySet.Attach(Obj); var Entry = this.Entry(Obj); Entry.State = EntityState.Modified; this.SaveChanges(); } This is a method exposed by my dbContext Called this way: PersistentManager.Update(PersistentManager.Personas,UpdatedPersona); The problem is, EF will update any property but the referenced Plan object. Can someone tell me where is the mistake? In advance : the entity reaches the point of update with all the properties correctly set. EF just fails to update the FK in the Database (no exception though)

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >