I have a SampleDB that contains 3 tables.
Table Employees (EmployeeID, EmployeeName)
Table Projects (ProjectID, ProjectName)
Table ProjectResources (ProjectID, EmployeeID)
The ProjectResources table is cross reference table that creates a many-to-many relationship between Employees and Projects.
I would like to use LINQ to select all...
I am using Entity Framework + AutoMapper to convert the EntityObjects to POCO.
The relationships in EF use EntityCollection<T>. The relationships in POCO use ICollection<T>. Since EntityCollection<T> : ICollection<T>, i thought it would be super easy to cast.
However, when AutoMapper tries to cast the EF EntityCollection<T> to POCO, it...
I have an asp.net web site and a database.
The web site has a web service for storing feedback from my software.
As far as I know, IIS will reuse the created object for sequential requests.
This gives a reason to connect to the DB in web service's constructor, properly implement Dispose() method, and use the connection for serving each...
I have just create a very basic Dynamic Data web application using Entity Framework, and when I click the edit command from the GridView, to open a Details view, edit some fields, and click the Update link, nothing happens.
My question is what could cause this update to do nothing and are there any tips for diagnosing it?
MORE INFO ...
Given a simple POCO class such as:
public class User { public int Id { get; set; } public string Name { get; set; } public string Password { get; set; } }
When I try a query with projection to itself like so:
using (var context = new Context())
{
var user = context.User.Select(u => new User { Id = u.Id }).FirstOrDefault();
}
... I ...
Hi
I see in my EF diagram alot of these navigation properties but not sure what they are really for. Like I see in lots of my tables I have aspnet_Users properties.
What are these for? Do they help for joins? or what?
Error 2
Error 3007: Problem in Mapping Fragments starting at lines 1201, 1423:
Non-Primary-Key column(s) [Field2] are...
I've created an ADO.NET entity data model with Visual Studio and have to assign the properties to a matching table now. If I create the data model with an existing database, Visual Studio uses this database automatically to assign the properties.
I have to start with a clear model because I don't have access to the database, the only thi...
Hi
I have asp.net membership and I use the built in Create user method since it is convenient now after this depending on the user I want to add 2 more fields to the aspnet_UserTable.
In my aspnet_user Table I have like this
// All Standard Fields that come with this table
ClubID<nullable)
ClubName <nullable)
I have a table that re...
Having two classes like Blog and Post, in Entity Framework (and LINQ-to-Entities), how can you get the blogs with the posts sorted by date. I was getting the blogs with the posts this way:
from blog in db.BlogSet.Include("Posts") select blog
and now I'm forced to do this:
public class BlogAndPosts {
public Blog Blog { get; set; }...
Hello,
I'm using .NET 3.5 SP1.
I created entity 'Category', based on table 'category_table' and 'MyUser', based on table 'App_User_table'.
CREATE TABLE category_table (
catg_id int,
catg_name varchar(50),
catg_description varchar(250)
)
CREATE TABLE App_User_table (
userid int,
username varchar(50),
fullname varchar(50), catg...
I'm using guids as PK for my entities.
As EF doesn't support the newid() SQL statement, I force a Guid.NewGuid() in my creation methods.
Here is my problem :
I've a table with a clustered unique constraint (2 strings, not PK).
I'm running some code in the same EF context which perfoms operations and adds/links entities, etc.
Is it pos...
I have this test in my test base:
public void WorksWithAreaUsers()
{
using (new TransactionScope())
{
//arrange
var userBusiness = new UserBusiness();
var user = new User
{
Name = "TestUser###",
Login = "domain\test-user###"
};
userBusiness.Add(user);
var...
I need some clarification re cascade deletes in Entity Framework and despite searching for hours am no closer to a solution.
In a nutshell, if I have an entity (MyObject) that has a 1->0..1 relationship with a child (MyObjectDetail) then I can't delete MyObject without an UpdateException complaining about constraints - but ONLY IF the ...
I have an application with an EDMX and an Ado .net data service in it.
I would like to make a call from the same application (not an http call) to the ado .net data service and would like to use the url like syntax to query using a string of filters that have been built up programatically:
public class AdventureWorksService : DataServic...
Hi
I have 2 tables that have a relation ship to each other
Table A has 1 to many relationship with table B
so this make a navigation property into each.
Now I need to check a value from Table A(userName) and I need to check a value from table B(ClubId).
So in my mind it would be something like
Join the tables together
Where A.userN...
I would like to use the Entity Framework against a database with well over 50,000 tables. I only want to create entities on a small portion of these tables (less than 10). When I go to add tables using the wizard or server explorer, Visual Studio seems to not be able to handle that large amount of tables. It appears as if the tree vie...
Hi
I have an Entity set that has Entities with a compound key containing ID (GUID) and CreatedAt (DateTime). This CreatedAt is when the entity was created. Each record represents each version of each entity such that muliple records can have the same ID.
I want to create an IQuerable-returning method that I can re-use such that it will...
I create some items from a class X.
I add them to de base, do SaveChanges and all this...
The class Y has a relationship many-to-many with X.
Using another Context, I create a Y instance, putting into the collection of X the elements I've created.
I add Y to Y entity set, it is fine.
When I do Context.SaveChanges(), I get:
A value ...
If I write a LINQ to Entities query does that get translated to a native query that the provider understands (i.e. SqlClient)?
OR
Does it get translated to Entity SQL that the Entity Framework then translates to a native query and passes to the provider?
If it gets translated to Entity SQL where I would I be able to see the Entity SQ...
Hi
I made an Entity database and it generated all the tables but it seems to have forgotten about the aspnet_usersinRoles table.
I don't know why it would skip this one or how to add it.
When in I look in the Model Browser through VS2008 I see the the aspnet_UsersInRoles table.
...