In our layered application, we are accessing database via WCF calls. We are creating and disposing contexts per request. Also we are using POCO approach.
My question is, in pure POCO model (completely persistent ignorant POCOs) is it possible to track the changes, while we are creating and disposing context per request (as previous conte...
In EF eager loading related entities is easy.
But I'm having difficulties including inherited entities when loading data using table-per-type model.
This is my model:
Entities:
ArticleBase (base article entity)
ArticleSpecial (inherited from ArticleBase)
UserBase (base user entity)
UserSpecial (inherited from UserBase)
Image
R...
I have to delete all rows of a model with condition fkey_id = 1
What 's the better mode?
thanks
...
Hi i have a model where i have to count the rows with conditions:
uscitaservizio == false and accountid attribute (int) is in a string filtrodipe
es: filtrodipe = "2,4,5,6"
I' ve tried with this:
db.TDP_Missioni.Count( p => p.UscitaServizio == false &&
(objUser.FiltroDipe != null ? (p.AccountID.ToString() in objU...
On an ASP.NET web page I have an EntityDataSource:
<asp:EntityDataSource ID="EntityDataSourceOrders" runat="server"
ConnectionString="name=EntitiesContext"
DefaultContainerName="EntitiesContext"
EntitySetName="Order"
Select="it.OrderID,it.OrderCode,it.OrderDateTime"
Where="it.OrderDateTime >...
Hi i need to obtain the value of attribute of a model by passing the name of attribute like string.
ex
model["ModelID"]
is there any method for this?
thanks
...
I have a generic repository that I communicate with my object context with. My object context has function imports that I want to be able to call through my generic repository. Currently I call them through an "Execute" function, but this is not ideal because I have to pass in my function name and parameters as strings which can cause r...
Hi, I'm working on a C#.NET 3.5 WCF RIA Services app and having an issue with my Entity Framework model.
My entity Foo is mapped to a DB table and has a primary key called FooId. My Bar is mapped to a DB view. I've selectively designed this view to generate a composite key in the EF using two of the columns (by making sure they were non...
I have recently been trying to learn more about the Entity Framework technologies from Microsoft. I have found a situation which I am not sure if it is possible (or correct) to solve using EF.
I have lots of entities that can be referred to by lots of different names. For example, a persons occupation maybe described as "Coder", "Progra...
In the context of Entity Framework 4, the default behavior when adding a function import is to call it via ExecuteFunction<T>(), where T must apparently implement some property change notification stuff. (In my case it's generating a complex type derived from ComplexObject.)
I don't need or want any change notifications, and I'm requir...
I'm using two LINQ queries to access my database using Entity Framework:
The first stores a token in the database and gives it a 60 second timeout:
string tokenHash = GetTokenHash();
Token token = new Token()
{
Client = client,
Expiry = DateTime.Now.AddSeconds(60),
UserId = userId,
TokenHash = tokenHash,
};
context.AddT...
Hello,
I have on my EF Schema a relationship * - * (designed by a middle table with 2 keys).
When I want filter on each (ie : I want all market segment filtered by one function), I execute this query :
var requete = from mkt in ent.MARKETSEGMENT_MKT
where mkt.FUNCTION2_FUN.Where(fu => fu.FUN_ID == FunId).FirstOrDefault().FUN_ID == Fu...
I'm committed to EF as I'm currently using it in a project but I also find it a major pain and learning curve as there are some things it does not do well that I would expect it to.
Does anyone know if the following issues are any easier in EF 4.0?
Foreign key access, sometimes you want the foreign key from a table rather than an enti...
Two tables (MainTable and EventType). EventType is represented in code as an enumeration and is foreign keyed in the database so that it looks like;
Public enum EventTypeId As Integer
Blah = 1
Blurgh = 2
Whoo = 3
End Enum
I can run the following query fine;
From M in dbx.MainTable Where M.EventType.EventTypeId = 1
But I...
I have develop an application in MVC.
I have 4 tables in MYSQL database.
Topic(topicid,topic) with topicid as primary key
subtopic(subtopicid,subtopic)with subtopicid as primary key
question(questionid,question,answer) with question as primary key
Detail(Id,topicid,subtopicid,questionid,title); with Id as primary key
I have u...
I have my Entity Framework model setup with a Sql Server 2008 backend. In the database, every table has a "CreatedBy" and "CreatedDate" field. These values are assigned when the object is saved, either by the Entity Context, or by Sql Server. In Sql Server, these fields are marked as "not null".
I want these fields to be available...
Hello, I'm new to EF and I've been using the asp.net mvc databind method to update my models "tryupdatemodel", now I have to update a entity from a service layer, since TryUpdateModel is a asp.net mvc method I can't use it in the services layer.
What I need to do to update the data of an entity without using this method?
I'm using repo...
I have the following table structure, which is imported into an Entity Framework project:
(NOTE: I mislabled T1Name as T2Name in Table1)
I have labeled the Entity Objects. The many-to-many joint table Table5, is represented as an EntityCollection<Entity4> in Entity3, and as an EntityCollection<Entity3> in Entity4 (EntityCollection<T>...
Hi,
I am learning EF and came across the definition of a Complex Type:
"...used to define common properties among various entities."
This sounds exactly like factoring out shared state from a class and moving it into a base class. My question is - is this inheritance from EF's perspective ? I know that inheritance is supported in E...
I have a table with a column of type varchar where the majority of rows have numerical looking values, that is, each string contains nothing but the digits 0 through 9.
+------+
| n |
+------+
| 123 |
| 234 |
| BLAH | -- This row is an exception to the rule.
| 456 |
| 789 |
+------+
In MySQL, this works: SELECT * FROM t WHERE n...