In my entity data model I have an entity with one property as the primary key and another property that will have unique values too, so I’d like to create a unique index on that other property. The situation is very similar to the Person entity with the PersonID and PersonSSN fields.
Is there any way to specify in the designer or in the...
How do I include child entities from a DomainService, without the chance of my code being overwritten when I generate a new DomainDervice? I am trying to include sub entities with my query.
For instance, I have a ParentTable and a ChildTable. I can retrieve the ChildTable entities as follows:
Modify the DomainService metadata file to...
I have the feeling that using joins could make this cleaner
public override string[] GetRolesForUser(string username)
{
using (TemplateEntities ctx = new TemplateEntities())
{
using (TransactionScope tran = new TransactionScope())
{
int userId = (from u in ctx.Users
where u.UserName == u...
Hi,
I have a asp.net web application that uses Entity Framework. The application data layer uses a method outlined by Jordan Van Gogh found here. In a nutshell, this method uses one shared objectcontext instance per http request and is disposed of using a AspNetObjectContextDisposalModule that inherits IHttpModule.
I have added anot...
public void SomeMethod1()
{
using (TemplateEntities ctx = new TemplateEntities())
{
//do something in this ctx
}
}
public void SomeMethod2()
{
using (TemplateEntities ctx = new TemplateEntities())
{
//do so...
Hi I have tables
Movie - ID, Name, Description, DirectorID-Fk, MusicID-Fk
Director - ID, Name
Music - ID, MusicName
Now I am trying to insert a new record to movie but I dont know whether Director is already existing in the DB and same with the Music).
From UI i am taking all movie information, DirectorName and MusicName.
Now wh...
I think i am doing something wrong in here so i will paste here so you can put me to the right track:
public MembershipCreateStatus CreateUser(string username, string password, string mail, bool autoemail, string fullname)
{
using (TemplateEntities ctx = new TemplateEntities())
{
...
Hello
I wonder what's the difference between standard EF objects, POCO and Self Tracking Entities. I was looking the web but couldn't find a valuable introduction.
Any help would be appreciated.
...
How can one modify DomainService code without the custom code being overwritten?
Is there a way to put the custom code in a seperate class file?
Thanks.
...
For my web app i need to handle access requests. Requests are entered for a monday-sunday schedule specifying hours for each day. This week schedule can repeat up to 52 times. A user can have multiple schedules during a week (mon 8-9 and mon 10-11) There are the following requirements:
Searchable/filterable
Detect overlapping requests
...
How would I write a query using entity framework where I need to make a list with a column for the product, category and parent category. I have not figured out how to get the parent category. Any Help is appreciated.
So far I have the following:
from product in Products
select new { Ctg = (from prdCategory in ProductCategories
...
I found some examples of how to create unit of work with ef4, i haven't used di/ioc and i would like to keep things simple and this an example (90% inspired) and i think it's ok but since i am looking at a pattern to use from now on i would like to ask an opinion one last time.
public interface IUnitOfWork
{
void Save();
}
publ...
In the past I used Sub Sonic which has the activerecord pattern baked into the framework. With Sub Sonic it was very easy to find the "dirty" fields on an update. I now have a need to create an audit table in my application that utilizes Entity Framework 4. Is there a comparable feature in EF 4 that will give me the dirty fields?
Thank...
Hello,
I have 2 Entity Framework entity sets with many-to-many relationship (compromised of 3 DB tables). For the sake of the example let's say I have a Worker entity and a Company entity, where each worker can work at multiple companies and each company can have many workers.
I want to retrieve for each worker all the companies that h...
I have seen a couple of references stating that WCF Data Services handles change tracking automatically. Does that mean you don't need to create Self Tracking Entities (STE) and it works automatically with any entity object type? Sorry, a bit confused here and have been struggling to find a resource that clears this up for me.
Thanks
...
I have VS 2008 SP1 and SQL Compact Compact 3.5 SP 1 installed.
I can see "ADO.NET Entity Data Model" when I go to Add -> New Item in Web Application project but same is not shown in Smart Device 2.0 application.
How to use Entity Framework (which version) with .NET CF 2.0 application and SQL Compact 3.5 SP 1?
...
I work on speed optimization of my application, and what I have found is that LINQ (or EF) is creating some strange SQL for me that works slow.
Here is some code :
SomeList.AddRange(_databaseView
.Select(l=> new SomeViewModel
{
Date = l.Date,
...
Let's say that I have two entities, Team and Match. In every Match, there are two teams, the HomeTeam and the AwayTeam. A Team can have many matches, but HomeTeam and AwayTeam can only have one team each. Sometimes Team is a HomeTeam, and sometimes the same Team is an AwayTeam. I have provided just the basics for each of the classes:
pu...
by default Entity Framework maps tinyint to byte.
i tried changing the underlying type after it was generated to Boolean, but getting compilation error
Member Mapping specified is not valid. The type 'Edm.Boolean[Nullable=False,DefaultValue=]' of member blah...
is this possible in 4.0?
it wasn't my idea to use tinyint column as b...
How do I specify Xml or just in-memory storge for Entity Framework models? The connection string requires a provider (usually a SQL provider string). But it won't let me omit the provider.
I realize I could completely throw away the designer generated objects and go pure POCO, but then I'd have to implement my own serialization layer (c...