In our multi-tier business application we have ObservableCollections of Self-Tracking Entities that are returned from service calls.
The idea is we want to be able to get entities, add, update and remove them from the collection client side, and then send these changes to the server side, where they will be persisted to the database.
S...
I have an Entity Framework model using Table per Type Inheritance, but when I use a VS Data Generation Plan it produces duplicate keys in the child tables, which is a problem for EF. Does anyone know of a way to get this to work, so that the child tables do not have overlapping keys?
...
I am working in Entity Framework 4 and connecting to a database that I only have read access to. I would like to create an EF object from a table with way too many columns, however I only need a few. Is there a way to exclude columns from an entity? Preferably without having to repeatedly edit an xml file that may be overwritten if I try...
So I am looking at creating a generic Interface to interact with my DataStorage of my objects one that I can swap out to use EF4 or SubSonic or NHibernate or some NoSQL option.
So I have an ERD and every table has an auto incrementing int column "TableNameID" that is the primary key I am trying to figure out how to get a single record...
I want to load EF metadata from database at runtime. Is that scenario possible? First get the data from database, then write it to .ssdl, .msl and .csdl files sounds ok. But how to tell EF to use what I've loaded? Do I need to compile it or something like that?
...
Hi,
I need to update multiple databases in one transaction using entity framework. Means if we need to insert records in two tables of two different databases and insertion succeeds for first database but fails for other database then insertion in first database should also get rolled back.
Please let me know if we can do this using en...
I want to retrieve one page from a sorted table. I want the sorting and paging to be done on the server. For this I created the following compiled query:
internal static readonly Func<MyEntities, string, int, int, IQueryable<Model.Message>> MessagesPagedSortedByDateQuery =
CompiledQuery.Compile((MyEntities db, string folderId, i...
I'm trying to understand the Entity Framework, and I have a table "Users" and a table "Pages". These are related in a many-to-many relationship with a junction table "UserPages". First of all I'd like to know if I'm designing this relationship correctly using many-to-many: One user can visit multiple pages, and each page can be visited b...
Is it at all possible to use something like a switch statement in a compiled query for linq to entities/sql?
For example when returning sorted records from the database, I would like to use a switch-like statement within one compiled query to sort on different properties, instead of having to write 2 compiled queries (ascending & descend...
I am trying to create a generic method using EF4 to find the primary key of an object.
example
public string GetPrimaryKey()
{
....
}
To Give more info I am working off of the Tekpub StarterKit and below is the class I am trying to get up and running
using System;
using System.Collections.Generic;
using System.Linq;
using System.W...
I have three tables in my database: An A table, a B table, and a many-to-many ABMapping table. For simplicity, A and B are keyed with identity columns; ABMapping has just two columns: AId and BId.
I built an Entity Framework 4 model from this, and it did correctly identify the N:M mapping between A and B. I then built a WCF Data Service...
Hello all,
I'm sure I'm missing something very simple, but let's say I have two entities, Employee and EmployeeType.
Employee type would contain values like 'Full time', 'Contractor', 'Intern', etc.
An Employee entity would contain one, and only one EmployeeType value.
So I am designing a new .edmx model using the Model-First app...
I have a Page table and a View table. There is a many-many relationship between these two via a PageView table. Unfortunately all of these tables need to have composite keys (for business reasons).
Page has a primary key of (PageCode, Version),
View has a primary key of (ViewCode, Version).
PageView obviously enough has PageCode, Vi...
Hello,
I'm writing a standalone application and I thought using Entity Framework to store my data.
At the moment the application is small so I can use a local database file to get started.
The thing is that the local database file doesn't have the ability to auto generate integer primary keys as SQL Server does.
It's not a problem de...
I have done some research on the optimistic concurrency of entity framework and how to ensure that concurrency is dealth with. Mostly it seems that you have to set concurrencyMode=fixed on certain fields in a table, or to keep a detached object of the object being changed.
However, we make use of a once off call method that makes use of...
I'm trying to write a utility that automatically sets the ProviderManifestToken attribute in an EDMX document Schema element, but even my basic XPath is not working. What am I doing wrong?
The XML:
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<!-- EF R...
I've been using the entity framework in combination with the self tracking entity code generation templates for my latest silverlight to WCF application. It's the first time I've used the entity framework in a real project and my hope was that I would save myself a lot of time and effort by being able to automatically update the whole da...
I have been attempting to implement the Entity framework into my project and unfortunately it seems like mapping an XML result set from SQL is not something that is supported. I also have issues with returning multiple result sets, though I understand that the EFExtensions was created to try to mitigate that issue.
Is there a way to ta...
Hello,
In my system I'm using entity framework. I have the following objects: Person, User, Customer.
Customer inherits User which inherits Person.
I would like to create a Full Text Search for customers in the system that will query also fields from the People table.
I know I can't use Full Text Search directly with LINQ-to-Entities,...
It seems that lazy loading is enabled by default in EF4. At least, in my project, I can see that the value of
dataContext.ContextOptions.LazyLoadingEnabled
is true by default. I don't want lazy loading and I don't want to have to write:
dataContext.ContextOptions.LazyLoadingEnabled = false;
each time I get a new context. So is t...