entity-framework-ctp5 Questions

2

Solved

Here is my Model: public class Customer { public int ID { get; set; } public int MailingAddressID { get; set; } public virtual Address MailingAddress { get; set; } public virtual ICollection...
Tomblin asked 18/3, 2011 at 0:39

1

Solved

I have an entity named Tour which can have many Agents. I am able to add agents, but I cannot remove them. // _repo is injected.... var tour = _repo.GetById(tourId); tour.AddAgent(new Agent(tour.To...

1

Solved

In EF4, this was not easily possible. You either had to degrade to classic ADO.NET (DataReader), use ObjectContext.Translate or use the EFExtensions project. Has this been implemented off the shel...

2

I just want know best practice about writing repository methods. Problem is deciding to write repository in which context has no lazy loading. How do you naming your method if it is GetById but it ...
Illustrative asked 13/3, 2011 at 23:22

1

Solved

How would I map something like this using the modelBuilder? Where theres a nullable foreign key referencing the same tables primary key Table: Task taskID int pk taskName varchar parentTaskID int ...

1

Solved

I'm using EF CTP5 code-first with Sql CE 4.0. I am trying to perform a time-insensitive date comparison between two DateTime properties. As linq to entites cannot parse the DateTime.Date property ...

1

I have this schema: create table Person ( id int identity primary key, name nvarchar(30) ) create table PersonPersons ( PersonId references Person(id), ChildPersonId references Person(id) ) how...

1

Solved

I am using Entity framework Code First CTP5 and I am trying to find a way to add a convention to change how foreign keys name are generated. Here is an example: public class Lead { public int Id ...
Lice asked 24/2, 2011 at 21:34

1

Solved

When I try to join tables var query = from foo in db.Foos from bar in db.Bars where foo.ID == bar.FooID where foo.ID == 45 select bar; query.toArray() I get such error Unable to create a...
Martyrize asked 25/2, 2011 at 0:15

1

Solved

Assume the following table structure: Tables: **Tasks** taskID int PK taskName varchar **Resources** resourceID int PK resourceName varchar **Assignments** assignmentID int PK taskID int FK res...

1

Solved

Using EF CTP5, I am trying to do some entity splitting where the entity is constructed from two separate tables. Is it possible to do this splitting if the key on the two tables is not the primary ...
League asked 17/2, 2011 at 16:38

1

Solved

Ive been able to implement a little cool unit of work to work with entity framework. I came up with .. public class UnitOfWork : IUnitOfWork { private Database _database; private IDatabaseFact...
Valletta asked 5/2, 2011 at 15:53

1

I am having trouble figuring out something with the Entity Framework Code First stuff in CTP 5. It is doing caching of objects and I don't want it to. For example, I load a page (working with an AS...
Bondon asked 6/2, 2011 at 1:52

2

Solved

Is it any better? I heard the CodeFirst extension but is it ready for primetime. Please share your experience with development, any performance overheads, etc.

2

Solved

I saw this comment on MSDN (link and link): "Note that Independent Associations should often be avoided since things like N-Tier and concurrency becomes more difficult." I'm new to EF4 and I...

2

Solved

In this blog post: EF4 Code First Control Unicode and Decimal Precision, Scale with Attributes, Dane Morgridge used attributes to control the creation of different types on your database. ...And I...
Encephalon asked 28/1, 2011 at 15:16

1

Solved

Attempting to cutover our EF4 solution to EF CTP5, and ran into a problem. Here's the relevant portion of the model: The pertinent relationship: - A single County has many Cities - A single C...
Occasion asked 26/1, 2011 at 23:56

1

Solved

This may be a simple answer, but i can't see how to execute a stored procedure with EF CTP5. In Entity Framework 4.0, we did this: ExecuteFunction("ContainerName.StoredProcName", new ObjectParame...

1

Solved

I am following this article on MSDN. I ported it to EF Code First. public interface IUnitOfWork { IRepository<Employee> Employees { get; } IRepository<TimeCard> TimeCards { get; } v...

1

Solved

It is working code; IQueryable<Product> productQuery = ctx.Set<Product>().Where(p => p.Id == id).(Include"Contexts.AdditionalProperties.Field"); But you know that it could not pro...
Dug asked 20/1, 2011 at 18:18

1

Solved

By code-first approach (but with an existing db schema), we are trying to map 2 different entities (Customer and Resource) to the same table. Both entities has the same keys and mapping. However, ...

1

Solved

In Fluent NHibernate you are able to set the cascade settings for a mapping e.g. public class StoreMap : ClassMap<Store> { public StoreMap() { Id(x => x.Id); Map(x => x.Name); Has...

© 2022 - 2024 — McMap. All rights reserved.