I've begun experimenting with LINQ to SQL and what I am doing is basically creating classes with LINQ mapping decorators - thereby choosing which parts of the db table schema I want to incorporate into my classes.
A simple example:
private DateTime? _LocalCopyTimestamp = (DateTime)SqlDateTime.MinValue;
[Column(Name = "recaLocalCopyTime...
I am interested in learning all about the Entity Framework.
I have found these videos.
I also have the book Programming Entity Framework, 1st Edition by Julia Lerman.
Does anyone have any other recommendations for learning this new technology?
...
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 have a varbinary(max) field in one of my tables but I don't need it every time and I'm looking for a way to fetch it from the database only when necessary. I'm using ADO.NET Entity Framework. How to do that?
...
I'm trying to query an Entity to return multiple rows based on a filter.
For instance in SQL we have:
SELECT * FROM table WHERE field IN (1, 2, 3)
How do I do it in LINQ to Entities?
...
I'm trying to create an expression to be used by the Where method of a LINQ to Entities query.
Effectively:
query.Where(farm => farm.PartyId == id);
(id is an int)
The code I'm using is:
private struct Parameter<T>
{
public T Value;
public Parameter(T value)
{
Value = value;
}
}
Parameter<int> idParameter...
We are about to start a project which involves using a Sql Server 2005 with lakhs of records. In the past I have used NHibernate with good results. But now I am evaluating Linq to entity for the data access. I have these questions on L2E,
How good is the caching that the L2E does compared to NHibernate (basically how is the performanc...
Hi!
I have four tables:
- Client with PK ClientID.
- Destination with PK DestinationID.
- Language with PK LanguageID.
- DestinationDetail with PK DestinationID.
- RL-Client-Destination with PKs ClientID and DestinationID.
The Client may have zero or n Destinations. A destination has n DestinationDetails, each of these DestinationDet...
I wrote this:
var destinations = db.DestinationDetails.
Where(dd => dd.Language.Lang == "en-US"
How can I retrieve destinationDetails that client with email [email protected] doesn't have?
This doesn't work:
var destinations = db.DestinationDetails.
Where(dd => dd.Language.Lang == "en-US"
Thanks!
...
Imagine this case:
var locations = from Locations in this.LocationDataContext.Locations
.Include("ChildLocations")
where
(Locations.LocationType.ID == 3)
select
Locations;
This query will load all loca...
I don't want to use array sorting on the web server it should be done on SQL server.
Microsoft does not support query(in EF) like this:
SELECT * FROM [Table_1]
ORDER BY [Table_1].field
COLLATE SQL_SwedishStd_Pref_Cp1_CI_AS
Any ideas?
Thank you in advice...
...
While building by DAL Repository, I stumbled upon a concept called Pipes and Filters. I read about it here, here and saw a screencast from here. I am still not sure how to go about implementing this pattern. Theoretically all sounds good , but how do we really implement this in an enterprise scenario?
I will appreciate, if you have any ...
Does anyonw know how to extend, i.e., add funcionalities to the Entity Designer in Visual Studio?
For instance, I want to right click a property of an entity on the designer and have a new option on the context-menu that allows me to do any stuff I want.
...
The executeTime below is 30 seconds the first time, and 25 seconds the next time I execute the same set of code. When watching in SQL Profiler, I immediately see a login, then it just sits there for about 30 seconds. Then as soon as the select statement is run, the app finishes the ToList command. When I run the generated query from M...
So I have my edmx made.
Then I change my database a little bit, changing a column to from being a NOT NULL to allowing NULL.
I go into my edmx, right click and choose "Update Model from Database"
Now I go into my program and it hasnt actually updated... I can't put a null in the column. What do I have to do to update the edmx prope...
So with LINQ-to-SQL I know you can update the database from the LINQ objects and update the LINQ objects from the SQL.
I am using LINQ's entity framework (a.k.a. LINQ-to-entities) and I can update the entities from the SQL database, but I can't update the database schema by changing the entities.
This is frustrating. Is there somethin...
So far as I gathered, LINQ to entities encourages eager loading with Load() or Include(). However, I wonder where should the eager loading take place in a multi-layered application?
Is it correct for the data-access layer (a repository class encapsulating the Entity instance) to have a generic Item GetItem(int id) function, and in busin...
We have a class library (ProjA) which has L2E object context. This will be used in an Website (ProjB) and WCF Service (ProjC). How do I specify the connection string in the website (ProjB) web.config so that it uses the resource files from the class library project (ProjA).
connectionString="metadata=res://*/db.csdl|res://*/db.ssdl|res:...
I have a complete separation of my Entity Framework objects and my POCO objects, I just translate them back and forth...
i.e:
// poco
public class Author
{
public Guid Id { get; set; }
public string UserName { get; set; }
}
and then I have an EF object "Authors" with the same properties..
So I have my business object
var auth...
So I was doing some profiling of different ways to hit my SQLServer database. I did vanilla TSQL, a CompiledQuery, and a noncompiled Linq statement.
The performance went in that same order, as expected, but I noticed something curious when profiling the latter two.
The SQL generated by the CompiledQuery was MUCH better than what was g...