Greetings,
Trying to sort through the best way to provide access to my Entity Manager while keeping the context open through the request to permit late loading. I am seeing a lot of examples like the following:
public class SomeController
{
MyEntities entities = new MyEntities();
}
The problem I see with this setup is that if you...
I must admin this is kind of funny even though I think I understand why :) I created a UnitTest to add a blog entry to try Alex suggestion about my inheritance problems. Now I come across another one.
[TestMethod]
public void UserCanAddBlogEntry()
{
var context = new EntityContext(Options.LazyLoading);
var user = (from u in con...
I recently came across a question in the Entity Framework forum on msdn:
http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/bb72fae4-0709-48f2-8f85-31d0b6a85f68
The person who asked the question tried to do a relatively simple query, involving two tables, a grouping, order by, and an aggregation using Linq-to-...
Hello Everyone !
i think my whole questions is inside title bar =]
but i'll explain little more.
i've got 2 related tables in database ( Customers and Orders )
and wcf service which returns Customer and all related Orders as DTO's
like this :
class CustomerDto
{
int ID;
IList< OrderDto > Orders;
}
and :
class OrderDto
...
How can I use the NOLOCK function on Entity Framework? Is XML the only way to do this?
...
Why would the Entity framework not understand the following statement?
oDestinations.Where(c => c.c_Resources.ResourceID == ID)
...
Hello!
I use these sentence in C# to retrieve data from tables DetalleContenido and Archivo:
var detallesContenido =
from contenido in guiaContext.Contenido
where contenido.PuntoInteres.id_punto == puntoInteresID
from dc in contenido.DetalleContenido
where dc.Idioma.ds_idioma == idiomaCliente
select dc;
The relati...
Over the months I've written some nice generic enough functionality that I want to build as a library and link dynamically against rather than importing 50-odd header/source files.
The project is maintained in Xcode and Dev-C++ (I do understand that I might have to go command line to do what I want) and have to link against OpenGL and S...
Hi,
Does anyone know what the esiest way to update the entity model after adding/deleting the fields in the database?
I am adding a few new fields to my database, then choose "Update Model from DB" and nothing happens. The model stays intact. Did anyone encounter the same problem?
Thanks for any feedback!
...
Hi,
I am currently reading about the possibility about using inheritance with Entity Framework. Sometimes I use a approch to type data records and I am not sure if I would use TPT or TPH or none...
For example...
I have a ecommerce shop which adds shipping, billing, and delivery address
I have a address table:
RecordID
AddressTypeID...
I am using the Ado.Net Entity Framework with ASP.NET MVC.
In my MSSQL 2008 Database I have for example the following simplified tables and relations:
(Song) 1--* (Version) 1 -- 1 (VersionInfo)
Is it possible to automatically have the linked Versions and their VersionInfo's deleted when I delete a Song?
Currently I am using somethin...
Hi,
I'm using the Entity Framework and I developed this extension method:
public static IQueryable<TResult> Like<TResult>(this IQueryable<TResult> query, Expression<Func<TResult, string>> field, string value)
{
var expression = Expression.Lambda<Func<TResult, bool>>(
Expression.Call(field.Body, typeof(string).GetMethod("Con...
Hi,
I'm coding this forum and since I'm new to LINQ I ran into this problem when the user hits the main page. I want a table displaying a list of forums like this:
Forum --- Topics (count) --- Posts (count) --- LastPostUserId --- LastPostTime
I have the following SQL tables:
Forums:
ForumId (int32),
Title (string),
Description (str...
I would like to experimentally apply an aspect of encapsulation that I read about once, where an entity object includes domains for its attributes, e.g. for its CostCentre property, it contains the list of valid cost centres. This way, when I open an edit form for an Extension, I only need pass the form one Extension object, where I nor...
I'm playing around with the .NET Entity Framework, and my first task is to populate a grid, from which single objects are chosen for editing. My prior code simply calls a DB view, which uses joins to give me a denormalised, human readable display record. Now, building an OR mapped model, I come to a choice. Do I add my view, or should...
EDIT: Guys, sure I meant Entity Framework not ASP.NET MVC, it was a typo most probably!
Yesterday I came a cross this article that lists some of the bad stuff with Entity Framework. And after doing some google stuff I found this one which basically is the defender here. These two posts discussed some major issues of entity framework suc...
So far I did not like EF. Although I liked the tools and how easy it was to create certain types of mappings and relations, Other types were a pain and the Linq support in EF wasn't so great (couln't create my own filter extension methods).
Is the new EF in .Net 4.0 better. Given what I have stated so far is there a chance I will like i...
So I have pouring of this code forever, trying to figure this out... I am using Entity Framework 1.0 with ASP.NET MVC in .NET 3.5 SP1 with EFPocoAdapter (so separate Poco classes).
So I have the following code for one of Controllers:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult EditUser(int? id, FormCollection form)
{...
I have the following query:
var MyQuery = from e in ContractContext.Equipments.Include("Manufacturers")
where e.Customers.ID == customer.ID
select e;
And everything works, I get my Equipments and it loads the Manufacturers table correctly (eagerly). But when I try to do the following many-to-many query:
v...
If I a many-to-many relationship between Users and Roles and I have an instance of a User entity and several Role Ids can I insert a relationship between the two types of entities without having any other Role data and without doing a select on the Roles first?
Update:
I might not have been clear enough. I don't have an instance of a ...