I have 3 tables
Table 1
Id
Name
Table 2
Id
Name
Link Table
Table1Id
Table2Id
The link table sets up a many to many relationship between Table 1 and Table 2. I'm using the entity framework which does not automatically create an entity for the Link Table and I need to be able to manage that table directly. Therefore, I need ...
I know it is rather heated question. But anyway I'd like to hear opinions of those in Stackoverflow. Given that XML support is quite good in SQL Server 2005/2008, and there's no concern about database independency, why one need Linq-to-SQL, Entity Framework, NHibernate and the likes, which are quite complex and awkward in advanced use-ca...
Hello,
I'm wondering if it is possible to refresh all entities from data model as opposite to refresh them one by one.
Something like entities.RefreshAll();
Regards,
Daniel Skowroński
...
Is it possible to set entity framework string comparison case insensitive by default?
If I use string.StartsWith("stringToCompare", StringComparison.CurrentCultureIgnoreCase), it works. But when I need to use string.Contains("strigToCompare") it doesn't have an overload.
...
Hi guys, This is my first question in stackoverflow but really not the first time to get solution here. I am struggling with multiple join in entity framework 4. I have three tables (Accounts, Users and AccountUsers) that am finding difficult to query.
What I want is to get all the users for the provided accountId including the account ...
Hi,
I've two entities with 1 to N relation in between. Let's say Books and Pages.
Book has a navigation property as Pages. Book has BookId as an identifier and Page has an auto generated id and a scalar property named PageNo. LazyLoading is set to true.
I've generated this using VS2010 & .net 4.0 and created a database from that.
In t...
Following works (ordered by name):
from t in context.Table1.OrderBy( "it.Name" ) select t
This doesn't work (no ordering):
from t in context.Table1.OrderBy( "it.Name" )
join t2 in context.Table2 on t.SomeId equals t2.SomeId select t
Nor does this (trying to reference the parent table to order):
from t in context.Table1
...
Hi everyone.
Here is the situation:
Lets's imagine we have table A in the database and we've created Entity model for that table.
Let's also imagine that there are several Uniqeu and Foreign constraints in that table.
Now let's do the following:
load more than 1 record from that table into the context.
Change some objects to make som...
Currently I am doing:
var items = from t in entity.Items
select new
{
Name = t.ItemName,
Description = t.ItemDescription
};
myDataGridView.DataSource = items.ToList();
The problem is that when bound to the DataGridView, I get two columns of "Name" and "Description". I want to rename these to "Item Name" a...
First I come from a nettiers background. And I really think that is getting in the way of trying to figure out how to use EF4.
Second. I am using the POCO templates available from MS. I have lazy loading enabled as well as proxy generation.
in my application I am eagerloading an selected doctors information from my users selection:
do...
Hi all,
I am currently in the process of designing/implementing a repository pattern in a .NET application. After many days of research I feel I am getting close but there really is so many ideas and opinions out there I was hoping to get some peoples thoughts on any design considerations they may have had if you've implemented one your...
Hi,
I keep getting this error:
Microsoft.Practices.Composite.Modularity.ModuleInitializeException was unhandled
Message=An exception occurred while initializing module 'DiagrammerModule'.
- The exception message was: An exception has occurred while trying to add a view to region 'MainRegion'.
- The most likely causing except...
Hi,
I am trying to create an Entity Framework 4 model based on a legacy SQL server 2008 database. Since the model is going to be published in a web service, I need to omit an integer column called NewsletterSubscribed from one of the model's entities.
After removing the column in the EF designer I got the following compilation error:
...
Hi all,
From one side, I want to write a killer app(in ASP.NET MVC) ;)
But from the other side, I have many doubts if I should keep to so called "best practices" at all cost. So I have a design question and I really hope you can help me out.
Imagine a standard blog. I want to show 10 most recent posts. My database has standard
Posts, C...
VB .NET 4 WinForms application.
I have a (DevExpress) grid bound to an IEnumerable(Of MyClass).
Whenever a new row is added, the ID defaults to zero (0). On trying to SaveChanges, EntityFramework doesn't realise that being an identity field means it should ignore any contents on insert and just insert the other values. I can't specify n...
When using wcf and entity framework 4 is it necessary to use POCO? If not how to combine DataContracts with generated classes(i figure one solution is to recreate the domain classes as business classes)?Or what is the best way co combine wcf 4 and ef 4?
...
In linq2sql I had this code to implement base class for repository
public abstract class Repository<T> : IRepository<T> where T : class {
protected DataContext context;
protected Table<T> table;
public Repository (DataContext context)
{
this.context = context;
table = context....
For example, one of the joys I've learned from L2S is that when creating the .dbml file, it automagically lets me create object of the Table with fields of the table columns. I do absolutely nothing and I can query things using a very natural approach using Linq and lambda expressions.
I've also been told that L2S doesn't work with many...
I have following tables:
Profiles:
ProfileID (Primary Key)
ProfileName, etc.
Contacts:
ContactID (Primary Key)
ProfileFromID (Foreign Key)
ProfileToID (Foreign Key)
Message varchar(50) , etc.
Profiles could have many contact messages. So a given message will have who sent the message and to whom the message was sent.
I am having di...
Hi,
I have added the connection string to the App.config of a main executable in my wpr, prism application and I get the following error:
System.TypeInitializationException was unhandled
Message=The type initializer for 'Microsoft.Practices.EnterpriseLibrary.Logging.Logger' threw an exception.
Source=Microsoft.Practices.EnterpriseLi...