I have an entity data model and a domain service (it may be a RIA service - I don't know) like this:
[EnableClientAccess]
public class MyService : LinqToEntitiesDomainService<NORTHWNDEntities>
{
public IQueryable<Categories> GetCategories()
{
return this.ObjectContext.Categories;
}
}
From what I understand this...
Hi,
I am creating a webapp using entity framework 4. As far as I can tell from extensive googling, it is best practice to create and kill the objectcontext when it is being used, and not let it live too long. So in my datalayer, I am doing something like:
using (var context = new MyDAO())
{
MY CODE
} creating and killing the context ri...
Hi everyone,
I am trying to resolve a situation I ran into when implementing EF with my project.
I have absolved the table-per-type approach, in my case the ActionUpdate derives from the ActionHistory and that works fine.
What I am trying to achieve is to derive the ActionUpdate from the ActionHistory, and to have a navigation propert...
I have the following query which I want to sort or filter using projected class names:
List<CompanyInfo> list = new List<CompanyInfo>();
using (var db = new DbContext())
{
list.AddRange(
db.Companies.Include("Projects")
.Select(row => new CompanyInfo()
{
Pr...
All identities of entities in model have name "EntityNameId". How I can rename all identity to "Id"?
...
Does anyone know any way to have the Entity Framework working with mysql connector 6.3/6.4 no install version? I can add the dll-s to my project, but I can't add the connection to the Entity framework because it doesn't see mysql.
...
Hello Everyone.
I have a solution in Visual Studio 2008 with 3 projects. One Web Application and 2 class libraries. The entity framework model is in a class library and the start project is the web application.
I used to have this problem:
"The specified named connection is either not found in the configuration, not intended to be use...
Hello,
I am using an ObservableCollection to wrap some of my generated entity framework objects.
When the user wants to edit some values , i am opening a popup windows that contains fields, and when the user changes and press save - the changes are saved to the database, and the binded controls are changes as it is an observablecollect...
Could someone clear something up for me? As far as my understanding goes, the physical model describes how the data is represented in the context of a specific storage medium. The logical model is a representation in terms of entities and relationships, independent of any particular data management technology. How do these two work with ...
I have a many to many relationship between Contractors and SafetyCouncils. They are joined by a bridge table ContractorsSafetyCouncils which consists of ContractorId and SafetyCouncilId. These 2 columns form a composite key. This relationship is mapped correctly in EF4. The Contractor entity has the property:
public virtual ICollection<...
I an developing a page where users will be able to add and modify existing content, its not a wiki per sé but sort of, like SO's editing abilities.
I am working with EF4 and the new Code First approach in the latest CTP, so what would be the best class design for this?
my current guess is something like this:
public class VersionableT...
Depot_ID is a foreign key in the database table Address. In my entity model i noticed that the foreign keys are not listed in the diagram
var Address = db.ADDRESS.Where(a => a.Depot_ID == id.Value);
This does not work as Depot_id is a foreign key in the Address table. What do I need to do to filter on this field?
...
I'm working on a plugin that gets loaded via IOC from a 3rd party data driver. The plugin and data driver both operate on the same SQL Server 2005 database, but the plugin focuses on a small subset of tables that have foreign key relationships to the tables that the data driver manages.
My problem is that in some operations, the data d...
My company has made an Entity Framework model of the database with all of the relationships mapped out and I'd like to take a screenshots of that with all of the FKs included in it. But I can't seem to figure out how to take a screenshot that includes all of that information. Any advice?
The "Export as Image" feature of Entity Framework...
This is driving me nuts. What am I missing here. I'm using EF and if I have code like the following:
using (LexiconEntities ctx = new LexiconEntities())
{
var query = from w in ctx.Words
select new WordEntryDataModel
{
Word = w.Anagram,
NumOfAnagrams = w.NumAnagrams.Value,
Length = w.Lengt...
I have an app that uses EF POCO for accessing data. Everything works great, yet there is one problem with unit testing. Imagine two related classes:
public class Brother
{
public virtual Sister Sister { get; set; }
}
public class Sister
{
public virtual ICollection<Brother> Brothers { get; set; }
}
The problem here is that if...
I've been a heavy user of .Net since its inception, but I have avoided using any of its ORM features, regardless of flavor. I have always been skeptical of tools which abstract CRUD, binding, validation, searching, etc. Some of this skepticism comes from painful, real-world experience; the rest of it comes from the innate desire to "own"...
I am using the Entity Framework to update my database.
The Employee table has an employeeId primary key field.
When I instantiate an employee object, the employeeId defaults to zero.
I want to insert the employee object into the database, ignoring the primary key value of zero.
Yet I get this exception;
Cannot insert explicit value for i...
Hi!
I have this applikation that is actually two applications, a webapplication and a console application. The console application is used as a scheduled task on the windows machine and is executed 3 times a day to to some recurring work. Both application uses the same Model and repository that is placed in a seperate projekt (class lib...
I have an extension method to dynamically filter Linq to Entities results using string values. It works fine until I use it to filter nullable columns. Here's my code:
public static IOrderedQueryable<T> OrderingHelperWhere<T>(this IQueryable<T> source, string columnName, object value)
{
ParameterExpression table = Expression.Paramet...