I'd like to use the ADO.NET Entity Framework for data access, extend its objects for my business logic, and bind those objects to controls in my UI.
As explained in the answers to another question, I cannot extend ADO.NET Entity Framework objects with partial classes and use my custom methods in LINQ queries.
I don't want methods sho...
I've been reading on the blogosphere for the past week that Linq to SQL is dead [and long live EF and Linq to Entities]. But when I read the overview on MSDN, it appeared to me Linq to Entities generates eSQL just the way Linq to SQL generates SQL queries.
Now, since the underlying implementation (and since SQL Server is not yet an ODB...
Hi guys,
I'm trying out Linq for the first time and having a bit of difficult retrieving the child objects of an entity. I have a course table which has a one to many relationship with the department table (ie. one department can have one or many courses).
When I select the a particular department I want to bind the courses relating ...
We been having some discussions on approaches to using the entity framework at work recently. We have a fairly large and complex n-tier web based application, which is due for a major overhaul.
The question is: If we where to starting using the entity framework, would it be better to create one big model, or a set of smaller functional/...
Hi,
Does anyone know if its possible to create a new property on an existing Entity Type which is based on 2 other properties concatenated together?
E.g. My Person Entity Type has these fields "ID", "Forename", "Surname", "DOB"
I want to create a new field called "Fullname" which is
Forenames + " " + Surname
So i end up with "ID",...
I've been creating a nice T4 template for a repository pattern for my entities. Instead of manually parsing the xml in the edmx file I use the EdmItemCollection to create a object graph presentation for the conceptual model.
I've been able to get a lot of information out of this model. But I cant find where to locate the Getter and Sett...
I have a table User which has an identity column UserID, now what is the correct Linq to Entity line of code that would return me the max UserID?
I've tried
using (MyDBEntities db = new MyDBEntities())
{
var User = db.Users.Last();
// or
var User = db.Users.Max();
return ...
I'm new to using LINQ to Entities (or Entity Framework whatever they're calling it) and I'm writing a lot of code like this:
var item = (from InventoryItem item in db.Inventory
where item.ID == id
select item).First<InventoryItem>();
and then calling methods on that object like this:
var type = item.ItemTypeRe...
I have this query in LINQ to Entities.
var query = (from s in db.ForumStatsSet
where s.LogDate >= date1 && s.LogDate <= date2
group s by new { s.Topic.topicID, s.Topic.subject, s.Topic.Forum.forumName, s.Topic.datum, s.Topic.Forum.ForumGroup.name, s.Topic.Forum.forumID } into g
...
Could you tell me how to translate the following SQL code to Linq To SQL or Linq To Entites?
The correst SQL code is:
select CollectId,url,userid,pubtime
from Collect group by
url,collectid,userid,pubtime having
pubtime >= (select max(pubtime) from
collect d where d.url = collect.url )
order by Collect.pubtime desc
Th...
I have a partition-like database schema in my database.
There's one 'partitioning' table named SITE and every other table has a foreign key to that table (SITE_FK).
I wrote a partial class for an ObjectContext adding a SITE_ID property and a constructor that sets this property.
Now, after I instantiate an ObjectContext with some SITE_I...
I'm trying to use LinqToEntities and just noticed that there are no foreign key fields in the data model. That seems to cause some trouble when trying to add a record.
Reading around I found that when adding a record you can do something like this (Product has a foreign key to the Categories table).
Product myProduct = new Product();
...
I'm using LINQ to Entities (not LINQ to SQL) and I'm having trouble creating an 'IN' style query. Here is my query at the moment:
var items = db.InventoryItem
.Include("Kind")
.Include("PropertyValues")
.Include("PropertyValues.KindProperty")
.Where(itm => valueIds.Contain...
Hey,
I'm using Linq to entities applying a Table per Type approach. This has been going very well, up to now. I have the following setup:
Parent Table
Child Table (Inherits
from parent)
Grand Child Table
(Inherits from Child Table)
Linking Table (Has Foreign Key Nullable, to Child Table)
Here is the database diagram
Following the...
In a controversial blog post today, Hackification pontificates on what appears to be a bug in the new LINQ To Entities framework:
Suppose I search for a customer:
var alice = data.Customers.First( c => c.Name == "Alice" );
Fine, that works nicely. Now let’s see
if I can find one of her orders:
var order = ( from o in alic...
I was wondering if anyone had a better idea how to do this. atm returning IQueryable<Member> as ObjectQuery<Member> seems dirty to me.
namespace Falcon.Business.Repositories
{
using System;
using System.Data.Objects;
using System.Linq;
using Falcon.Business.Criteria;
using Falcon.Business.Entities;
using Falcon.B...
I'm currently thinking about a repository pattern for my data objects, where multiple IQueryable<> instances can be registered as data sources. But it seems its not so easy to get it running :-)
Running a simple LinQ Query with Linq to entities and linq to objects doesnt work. Do you think this is in general possible? Maybe the only sol...
I am starting to design a new application and what I am wondering is peoples opinions on Linq2SQL or Linq2Entities and what they feel is the better technology for rapid development.
I am also doing some research into ADO.net data services.
...
I'm trying to create a query which uses a list of ids in the where clause, using the Silverlight ADO.Net Data Services client api (and therefore Linq To Entities). Does anyone know of a workaround to Contains not being supported?
I want to do something like this:
List<long?> txnIds = new List<long?>();
// Fill list
var q = from t in ...
I have two entities, each from a different database and therefore different edmx files. There is, however, an infered relationship between them.
Foo has many Bars for example.
What's the easiest way to do this join in the EntityFramework, with fewest database calls?
Thanks.
...