Search Results

Search found 7266 results on 291 pages for 'entity relationship'.

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

  • Apress Deal of the Day - 22/Feb/2010 - Entity Framework 4.0 Recipes: A Problem-Solution Approach

    - by TATWORTH
    Todays $10 deal from Apress at  http://www.apress.com/info/dailydeal is "Entity Framework 4.0 Recipes: A Problem-Solution Approach" Whilst I am still wary of using the Entity framework and I would caution against its use for updates in financial systems, unless you use a technique such as you can find on pages 509-512 of this book. This book is very impressive as I found the answer to this in about 2 minutes from the time I downloaded the e-book. Entity Framework 4.0 Recipes: A Problem-Solution Approach With this book, you will learn the core concepts of Entity Framework through a broad range of clear and concise solutions to everyday data access tasks. Armed with this experience, you will be ready to dive deep into Entity Framework, experiment with new approaches, and develop ways to solve even the most difficult data access challenges. $49.99 | Published May 2010 | Larry Tenny

    Read the article

  • How to get address the object of an related entity with CoreData ?

    - by eemceebee
    Hi Ok, after I ran into a dead end modifieing an existing Apple example for CoreData, I started completely new creating my own project and that worked fine,..... until I tried to access a related entity. So here is what I did. I created 2 entities, where one is just the detail information of the other one, so there is a one-2-one relationship. Entity #1, Stocks: name value details -- relationship to Entity #2 Entity #2, StockDetails: bank published stock -- relationship to Entity #1 Now, I created the "Managed Object Class" for both of the Entities. Then I created a few lines to put some data into it NSManagedObjectContext *context = [self managedObjectContext]; Stocks *stockinfo= [NSEntityDescription insertNewObjectForEntityForName:@"Stocks" inManagedObjectContext:context]; stockinfo.name = @"Apple"; stockinfo.value = [NSNumber numberWithInt:200]; StockDetails *thestockdetails = [NSEntityDescription insertNewObjectForEntityForName:@"StockDetails" inManagedObjectContext:context]; thestockdetails.bank = @"Bank of America"; thestockdetails.published = [NSDate date]; thestockdetails.stock = stocks_; stockinfo.details = thestockdetails ; NSError *error; if (![context save:&error]) { NSLog(@"A Problem occured, couldn't save: %@", [error localizedDescription]); } Just want to mention here, that I do not get an error with this. Next I put everything into a UITableViewController for a preview and another for a detail view. The preview just shows infos form Entity #1 (Stocks) and when selected it shows the detail view. Now here I also display the infos form Entity #1 (Stocks) but I want to show the Entity #2 (StockDetails) aswell. This is how I try to access the data : StockDetails *details_ = [stockinfo details]; And this gives me a EXC_BAD_ACCESS. So any idea what I am doing wrong here ? Thanks

    Read the article

  • EF4 Code First - Many to many relationship issue

    - by Yngve B. Nilsen
    Hi! I'm having some trouble with my EF Code First model when saving a relation to a many to many relationship. My Models: public class Event { public int Id { get; set; } public string Name { get; set; } public virtual ICollection<Tag> Tags { get; set; } } public class Tag { public int Id { get; set; } public string Name { get; set; } public virtual ICollection<Event> Events { get; set; } } In my controller, I map one or many TagViewModels into type of Tag, and send it down to my servicelayer for persistence. At this time by inspecting the entities the Tag has both Id and Name (The Id is a hidden field, and the name is a textbox in my view) The problem occurs when I now try to add the Tag to the Event. Let's take the following scenario: The Event is already in my database, and let's say it already has the related tags C#, ASP.NET If I now send the following list of tags to the servicelayer: ID Name 1 C# 2 ASP.NET 3 EF4 and add them by first fetching the Event from the DB, so that I have an actual Event from my DbContext, then I simply do myEvent.Tags.Add to add the tags.. Problem is that after SaveChanges() my DB now contains this set of tags: ID Name 1 C# 2 ASP.NET 3 EF4 4 C# 5 ASP.NET This, even though my Tags that I save has it's ID set when I save it (although I didn't fetch it from the DB)

    Read the article

  • Entity Framework 1:1 Relationship Identity Colums

    - by Hupperware
    I cannot for the life of me get two separate tables to save with a relationship and two identity columns. I keep getting errors like A dependent property in a ReferentialConstraint is mapped to a store-generated column. Column: 'OlsTerminalId'. I can't imagine that this setup is abnormal. [DataContract] public class OlsData { private static readonly DateTime theUnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int OlsDataId { get; set; } [DataMember(Name = "id")] public int Id { get; set; } public DateTime Timestamp { get; set; } [DataMember(Name = "created")] [NotMapped] public double Created { get { return (Timestamp - theUnixEpoch).TotalMilliseconds; } set { Timestamp = theUnixEpoch.AddMilliseconds(value); } } [InverseProperty("OlsData")] [DataMember(Name = "terminal")] public virtual OlsTerminal OlsTerminal { get; set; } } [DataContract] public class OlsTerminal { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int OlsTerminalId { get; set; } public int OlsDataId { get; set; } [DataMember(Name = "account")] [NotMapped] public virtual OlsAccount OlsAccount { get; set; } [DataMember(Name = "terminalId")] public string TerminalId { get; set; } [DataMember(Name = "merchantId")] public string MerchantId { get; set; } public virtual OlsData OlsData { get; set; } } public class OlsDataContext : DbContext { protected override void OnModelCreating(DbModelBuilder aModelBuilder) { aModelBuilder.Conventions.Remove<PluralizingTableNameConvention>(); } public OlsDataContext(string aConnectionString) : base(aConnectionString) {} public DbSet<OlsData> OlsData { get; set; } public DbSet<OlsTerminal> OlsTerminal { get; set; } public DbSet<OlsAccount> OlsAccount { get; set; } }

    Read the article

  • Repository Pattern with Entity Framework 3.5 and MVVM

    - 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 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

  • How to avoid circular relationship in SQL-Server?

    - by Shimmy
    I am creating a self-related table: Table Item columns: ItemId int - PK; Amount money - not null; Price money - a computed column using a UDF that retrieves value according to the items ancestors' Amount. ParentItemId int - nullable, reference to another ItemId in this table. I need to avoid a loop, meaning, a sibling cannot become an ancestor of his ancestors, meaning, if ItemId=2 ParentItemId = 1, then ItemId 1 ParentItemId = 2 shouldn't be allowed. I don't know what should be the best practice in this situation. I think I should add a CK that gets a Scalar value from a UDF or whatever else. EDIT: Another option is to create an INSTEAD OF trigger and put in 1 transaction the update of the ParentItemId field and selecting the Price field from the @@RowIdentity, if it fails cancel transaction, but I would prefer a UDF validating. Any ideas are sincerely welcomed.

    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

  • MySQL Basic about relationship

    - by Roberto
    Hi all! My doubt is about how to treat the follow thing: I have a system where a user belong to a company, and this user have their clients. How is the right way to get a list of all company clients and the follow user name?? In the client table where i have a field with the one of this relations: A company_id and user_id field Just company_id field Just user_id field cause user table have the company_id??? Something else... Tkz Roberto

    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

  • Foreign Key Relationship in Rails

    - by Steve
    Hi...I am a beginner in Rails and I read that the Rails enforces the foreign key relationships at the model level and also at the database level in the migration file, while creating the table. Is it really necessary and what kind of advantage does it provide

    Read the article

  • Grails efficient hasMany-Relationship in View

    - by Jan
    Hi folks, I'm saving contacts (email, mobile phone, ICQ, AIM etc.) for people like this: class Person { static hasMany = { contacts: Contact } } class Contact { String code ContactType type } class ContactType { String name } In my view, I've written some Templates for displaying each contact with a select-box for the contact-type and a textfield for the code, spiced up with some JavaScript for adding and deleting. My question is: Is there an easy and elegant way to update the data similar to personInstance.properties = params or do I have to read out all the fields, deleting removed, updating changed and adding new ones?

    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

  • 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

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