Let's say I have a table of promo codes, and a table of contacts. Each contact can have 1 promo code, and each promo code can only be assigned to 1 contact. How would I employ an assignment program that would select a promo code from the table, and assign it to a contact, without having concurrency issues/collisions.
Worst case scenar...
Using entity framework, I'm trying to get back a customer with order details but I want to filter out those Orders that are active.
Customer is our EntityObject which has a collection of Order EntityObjects. CustomerDetails is our ObjectContext.
The code below will attach all orders but I want to filter and only attach those that are ...
If I have 2 tables 1 with a composite primary key where one of the keys is also a foreign key in another table:
Table 1:
A (PK, FK - maps to X in Table 2)
B (PK)
C
Table 2:
X (PK)
Y
Because A is both the PK in table 1 and FK in table 2, when I use EF to generate the entity model, I have both a Scalar AND a Navigation property f...
Doing some experiments around WCF and Entity Framework. A couple of questions.
Option 1:
I understand that entity framework classes can be serialized over WCF directly, with sp1 onwards. How ever, I would like to know how scenarios like delay loading, eager loading, context management etc is handled in this, if they are handled at all?...
Hi,
I am using silverlight client with ado.net dataservices on entity framework.
I have an Entity Contact and an Entity Address which is related with a foreign key relation ship...
A contact can have 1 or more Adresses but a Address needs always at least 1 contact..
pretty basic...
I have a Repository for my contacts and Address which...
Hello,
I have two tables, in a many-to-many relationship, with a junction table, as follows:
Member MemberGroup Group
========= ============ =======
PK | ID PK | ID PK | ID
| Name | Member | Name
| Group
| MemberSince
I need to add all the member...
Hello!
How can I do a "select count(*)" using ADO.NET Entity Framework?
Thanks!
...
I using extension for Object, because it provides very short accessible string.
public static BusinessLayer.Models.SearchEngineEntities db(this object o)
{
if (HttpContext.Current == null)
return new BusinessLayer.Models.SearchEngineEntities(ConfigurationManager.ConnectionStrings["SearchEngineEntities"].ConnectionString);
if (...
I just started to play with the entity framework, so I decided to connect it to my existing SQL Server CE database. I have a table with an IDENTITY(1, 1) primary key but when I tried to add an entity, I've got the above-mentioned error.
From MS Technet artice I learned that
SQL Server Compact does not support entities with server-g...
Hi!
I'm just starting developing with ADO.NET Entity Framework and I don't know how I would write this:
ClientEntities clientContext = new ClientEntities();
ObjectQuery clientQuery =
clientContext.Client.Where("it.email = @email AND it.password = @password",
new ObjectParameter("email", "[email protected]...
Hi Guys,
I have created an Entity Model from a DB, and getting an error "member names cannot be the same as their enclosing type". Which means there is a Property the same name as the Class.
So the error is here
/// <summary>
/// There are no comments for Employee in the schema.
/// </summary>
[global::System.Component...
I'm new to Linq to EntityFramework, one question in Linq2EntityFramework I have is when or if to dispose the ObjectContext. The reason I ask this question is that normally in my DAL I have code like
public List<User> GetUsers()
{
using (MyEntities db = new MyEntities()) //where MyEntities inherits ObjectContext.
{
...
Simple question, is it posible to achieve this query this with Entity Framework when updating one entity?
update test set value = value + 1 where id = 10
...
Is there a way to extract common columns from various tables into a single base class in the ADO.NET Entity Framework when using the EDMX designer? For instance, every single table in my database has a "LastUpdatedBy" and "LastUpdatedDate" column that is necessary for auditing purposes. I would like to set these values automatically in...
Hi!
I wrote this:
using (GuiaMovilEntities guiaEntity = new GuiaMovilEntities())
{
try
{
Cliente cliente =
Cliente.CreateCliente(-1, datosCliente.Email, datosCliente.Password);
}
catch
{
}
}
It's unfinished.
If table Cliente (represented by Cliente object) has its first row (clienteID) as IDENTITY ...
I have 3 entities
Printer
Server
Driver
The Printer has Server and Driver properties
Somwhere in my code I've set up an IEnumerable<Printer> where each instance of printer holds it's own Server and Driver entities.
Now when I'm trying to submit it to the db, I'm using following code:
foreach (Printer p in printers)
{
printman...
Hi,
How do i return matching entities in a random order?
Just to be clear this is Entity Framework stuff and LINQ to Entities.
(air code)
IEnumerable<MyEntity> results = from en in context.MyEntity
where en.type == myTypeVar
orderby ?????
s...
I´ve got this in a INSERT statment to MSSQL 2008
System.Data.SqlClient.SqlException:
The conversion of a datetime2 data
type to a datetime data type resulted
in an out-of-range value.
...
It seems that serializing Entity Framework objects into JSON is not possible using either WCF's native DataContractJsonSerializer or ASP.NET's native JavaScript Jersializer. This is due to the reference counting issues both serializers reject. I have also tried JSON.Net, which also fails specifically on a Reference Counting issue.
My ob...
Ok, I am planning to develop a project using Entity Framework. While i was trying to do some R&D before i kick off implementing it, I found this problem, hope some of you people help me find a solution to it.
I have a entity named 'Person' referenced with 'Members' entity with one to many (1:N) relationship. The task would be to query P...