Ok obviously I am fighting .net here ... and the answer is probably that i am barking up the wrong tree and should just get on with just using the kind of database design i would of 5 years ago.
What I want is to have an abstract object Client and have 2 inherited objects Supplier and Customer.
The relationship between client and both ...
I have a simple EntityFramework application that accesses SQL Server 08 with a single table. I want to get a count of the rows like this:
Dim x = (From y in _Ctx.Table1).Count
Here's the SQL generated from this EF:
SELECT
[GroupBy1].[A1] AS [C1]
FROM ( SELECT
COUNT(1) AS [A1]
FROM [dbo].[Table1] AS [Extent1]
) AS [GroupBy1...
I guess when I generate the entities, they don't have [DataContract] attribute, so I cannot pass the object to client.
...
Hi fnds,
There are lof of difference between Linq to Sql and Entity framework like Linq to SQL is one to one mapping and EF is many to many mapping and many other which can be found at
http://stackoverflow.com/questions/8676/entity-framework-vs-linq-to-sql
But here I am asking with EF and Linq to Sql, do we create Entities first and th...
I have 10 tables with the same design. Each of them has an IsActive Collumn.
EX:
Category
CatID
CatName
IsActive
Product
PrdID
PrdName
IsActive
Is there a way to create a generic method to update the IsActive column.
public void Deactivate<T>(T TEntity)
{
//Put the code to update
//IsActive
}
I Read ...
I'm running into some issues when constructing a query using LINQ and Entity Framework.
My model is like this
Merchants(MerchantId)
AffiliateFeeds(AffiliateFeedId, MerchantId)
ProductSKUs(ProductId, AffiliateFeedId)
This snippet works well enough:
// only get Merchants and AffiliateFeeds based on specific ProductSKU.Pro...
So I have a model in my domain similar to this:
public class Product
{
public virtual Tag Methodology { get; set; }
}
Then in an webform project I update it like so:
if (!string.IsNullOrWhiteSpace(ddlMethodology.SelectedValue))
product.Methodology = TagRepo.GetTagById(int.Parse(ddlMethodology.SelectedValue));
else
product...
I'm making a Silverlight 4 application with WCF RIA Services.
On the server side (the *.Web project), I have an Entity Model that's auto-generated from a SQL Server database.
On the client side, I have the domain service and proxy objects that are generated by Visual Studio for use in Silverlight assemblies.
I want to add custom proper...
I have a scenario where I need to open multiple datacontexts which point to different databases. I am only writing to one of the databases though and reading from the others ... so technically the transaction should only be against one of the databases.
I'd like to avoid having the TransactionScope upgrade into a distributed transaction...
I am using EF 4 Feature CTP 4.
I have the following database schema:
[Users] 1-M [UserRoles] M-1 [Roles]
I have a User and Role class (both POCOs).
When I try to associate an existing role to a user, a new record is getting inserted in the Roles table, instead of only inserting a new record in UserRoles.
So say I have User 1 and wa...
I created a "Code Only" POCO for use against an existing database using Entity Framework 4 and the CTP4. When I run a query I get the error
The model backing the 'xyzContext' context has changed since the database was created. Either manually delete/update the database, or call Database.SetInitializer with an IDatabaseInitializer inst...
We are rolling out our first .net 4.0 entity framework application and are having an issue with security.
We have it working on our alpha site inside our development environment with the following setup:
SQL2005
IIS6
.NET 4.0
asp.net mvc 2
Entity Framework
NTLM
But when we moved it to our production environment for beta testing we ...
Hello, another Entity Framework (ADO.NET) question from me.
I'm using EF1 (no choice there) and have a MySQL database as a backend.
A simple question I can't really find a satisfying answer for:
What exactly do I have to do for loading? IE., when I have an entity and want to enumerate through its children, say I have the Entity "Group"...
I want to make an entity internal. I've changed entity, its scalar properties and navigation properties to internal. I'm getting this error when I try to build it:
Error 6036: EntityType 'File' has 'Internal' accessibility and EntitySet 'Files' has a get property with 'Public' accessibility. EntitySet's get property must not have less r...
Hello,
is there any way of going through all the new/modified entities and setting their, inserted_at, updated_at fields?
With ObjectStateManager I can get a list of those entities but could not find a way of setting the entity property values.
foreach (var item in db.ObjectStateManager.GetObjectStateEntries(EntityState.Added))
{
Syste...
Hi experts,
I’m playing around with a little VB.NET app with WPf/MVVM and ADO.NET EF on a SQL Express-DB and I’m running into problems while trying to update related objects:
My DB has three tables “tb_Actors”, “tb_Movies” and a junction table “tb_movies_actors”. The EF designer creates two entities "Actors" und "Movies" and sets thei...
I can create objects of each table in my database, so the .edmx file is doing it's job.
Why can't I create a new dbEntEntities (intellisense only pops up dbNull) object of the .edmx file?
Thanks!
...
Hello.
My db has a configuration table with just 1 record and no primary key.
I would like to create a model with EF to map this table but when I use "Update model from database" the first field became the primary key.
When I remove the PK and build, VS shows:
The table/view 'dbo.TableName' does not have a primary key defined. The ke...
In my generic abstract class
class SomeClass<T> where T : ISomeInterface
I have a method that calls my repository and pass a parameter Expression<Func<T, bool>> parameter to tell him the 'where' condition.
As T implements ISomeInterface, the DebugView of the lambda passed brings me something like
...((ISomeInterface)$p).SomeInterfac...
Hello.
I am developing an piece of software where I have a few entities such as:
public class Workspace
{
public int ID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public virtual List<Playground> Playground { get; set; }
public virtual List<Workspa...