Hi there,
I know that i can enter/add new properties via code manually into partial classes but i wanted to use the model to add my new properties - reason being is that i can control a number of different attributes like NULL and things like that... and of course the code generations works great..
I added some foreign keys manually ju...
How would you to convert or cast a List<T> to EntityCollection<T>?
Sometimes this occurs when trying to create 'from scratch' a collection of child objects (e.g. from a web form)
Cannot implicitly convert type
'System.Collections.Generic.List' to
'System.Data.Objects.DataClasses.EntityCollection'
...
I was thinking how to write a proper LINQ query or lambda expression on one to many relation while do a proper filtering of the entity on the "many" side for Entity Framework.
So two entities are:
Recipe
id
name
type [small|big]
Ingredient
id
recipeId
name
type [regular|exotic]
So how to write a LINQ query that selects recipes that a...
I am wanting to create a Where statement within my Linq statement, but have hit a bit of a stumbling block.
I would like to split a string value, and then search using each array item in the Where clause.
In my normal Sql statement I would simply loop through the string array, and build up there Where clause then either pass this to a ...
I have a problem where I've mapped a stored procedure named sp_getMyEntity, which takes in one parameter called Id and then maps the results to a custom entity called MyEntity
I'm using mock data to illustrate the point. When I run the stored procedure with an id of 1, I get two distinct results back from the database:
exec [dbo].[sp_g...
In the "SavingChanges" event of the Entity Framework context, is there a way to ignore any changes that were made to a specific field/property?
Specifically, I have a property on my entity "CreatedBy". I need to set this property in the application, but once it is set (when the entity state is "Added"), I want the property to be availa...
I have a service. This service get data from SQL Server.
What the best way to send information to client?
Should I use ADO.NET or Entity Framework?
...
I 'm beginning a new web project and was wondering if i could benefit from the "magical" things RIA service can offer, but in a way i was used to develop until now.
This means i would like to architect the solution so that EF POCOs should be used, which are the basis for repositories (using IoC to resolve to concrete implementations), ...
I have an EntityDataSource with OnSelected event (fired after finished query). The event handler has event args of type EntityDataSourceSelectedEventArgs e. Query runs fine without error and the IEnumerable e.Results contains 1 object (I can run through a non-empty foreach-loop) but e.TotalRowCount returns -1.
Does somebody have an idea...
OK this problem has it all.
Conceptually I have a Resource entity which can have many Child Resources and many Parent Resources. The Resource table has two fields, ID and Name with ID being the primary key.
To complete the many to many relationship I created a ResourceHierarchy table which has two fields, (Parent_ID, Child_ID) and two ...
I am using the asp.net mvc with the Entity Framework.
I have a list of appointments with a startedat field, an endedat field and a roomid field (called SpaceConfigurationId) and would like to find the list of appointments that have been double booked for a given room. It is fine to assume that endedat is always after startedat.
There ar...
Hi guys
In a 1-M relationship, in the many side of the relationship I can pull out the Id of the parent item without doing another query using something like the following:
this.ParentReference.EntityKey.EntityKeyValues[0].Value
But what I am wondering if there a similar way of pulling out the many ID's from the 1 without doing anot...
Say I have a nice domain model, using (constructor) DI where needed. Now I want to be able to persist this model, so I start adding infrastructure(Entity Framework) to do this. What happens now is that the persistence framework should be able to initialize your types using your IoC container.
Maybe this is possible, maybe not. Anyway, w...
This problem is not readily reproducible in a simple example here but was wondering if anyone has any experience and tips, here is the issue:
using Entity Framework
have many points in application where (1) data is written to some entity table e.g. Customer, (2) data is written to history table
both of these actions use Entity Framewo...
I have a Person and an Organisation Entity:
Person looks like this:
public class PersonEntity
{
public string FirstName {get;set;}
public string LastName {get;set;}
public bool IsValid(PersonEnum Attribute, string AttributeValue)
{
if(attribute == PersonEnum.FirstName && AttributeValue == null)
return false;
if(attribute == PersonEnum....
Hi
I am using SQL Server with Entity Framework for a development of web app in .NET 4 with VS2010 RC. I would like to prepare testing database with sample data.
Should I prepare a copy of the real database (say another SQL Server database) for testing, or can I use SQLite in memory for better performance?
If using SQLite, can I use th...
How do I output/log the sql being executed behind the scenes by the Entity Framework in an asp .net mvc application? In my case I'm using a Sql Server 2005 database.
I found this question Linq to Sql logging, but I'm trying to figure out how to do this with the entity framework v1 and asp .net mvc 1.0. Any one have any ideas on how?
...
in my database a have an invoice table and a payment table.
i have a transactions view that shows payments and invoices.
i created an entity from that transaction view.
in my application i want to be able to add a payment from the transaction screen (which is a datagrid of transaction entities) and that the list of transactions be updat...
Hi,
I have a Visual Studio 2010 generated set of POCO classes (just out of the box POCO templates generated from DB Schema). For a given use case I let the user load an entity (a CRM contact) and act on it - add Phone Numbers (which in itself is a separate entity related by foreign key) and address (also a separate entity) etc. In bet...
I'm binding this Entity framework query to a gridview and is ultra slow. The delay is on databinding. Any solution?
Using ctx As New DBEntities()
Dim PROC= (From p In context.Table.Include("RELATION") _
Where p.KEY= 1 _
Select p).First()
Dim q1 = From r In PROC.relation _
Select New With ...