With .NET, which data access method is better to use "LINQ to SQL",entity framework, or NHibernate?
Should a different method be used depending on the situation or is it more of a personal preference?
If so which method and when?
...
There seems to be many different data access strategies coming out of Microsoft. There’s ‘classic’ ADO.NET, Linq2Sql, ADO.NET Entity Framework, ADO.NET Data Services, ADO.NET Dynamic Data. I’m sure that I’ve missed some. To me, it seems that there’s a lot of confusion surrounding where each frameworks fit into an application's architectu...
Okay, similar questions exist, but they are all about how to determine this from outside of the entity itself and use the DataContext the entity is attached to.
I am binding my entities to an edit form in WPF. Within a DataTemplate, I want to be able to set the background color of the root container within a DataTemplate to show it has...
Hi,
I'm trying to model a database in LINQ to SQL. I have a table JournalPosts. Each entity is associated with 1 or more senders or recipients. I have the following composite primary key in my table "JournalPosts":
[Column(IsPrimaryKey = true)]
public int CaseYear { get; set; }
[Column(IsPrimaryKey = true)]
public int ...
The following lines of code is producing this error: "Overload resolution failes because no accessible 'Single' can be called with these arguments". I'm not too good with VB, but since the app I've inherited was in VB, I didn't want to rewrite it all:
Dim a1 = From rows In db.tPDMLinkUsages _
Where (rows.ACCESSDATE >= DateTime.Today...
//A query to a local object
var deletionCommands = commands
.Where(a => a.Operation != Operation.Addition)
.Select(a => new { a.Prestador.cod_prestador, a.Prestador.cod_desdobramento })
;
//A Linq-To-SQL query
var toDelete = db.Prestadors
.Where(a => deletionCommands.Contains(new { a.cod_prestador, a.cod_desdobram...
When using Linq-to-SQL, adding a column to an existing table, and setting a default value on that new column, it seems that Linq to SQL ignores the default value.
Has anyone else experienced this behaviour? Is there a way to fix it, so that Linq-to-SQL or SQL Server automatically sets the default value?
The column I added was of type ...
I have the following SQL which I am trying to translate to LINQ:
SELECT f.value
FROM period as p
LEFT OUTER JOIN facts AS f ON p.id = f.periodid AND f.otherid = 17
WHERE p.companyid = 100
I have seen the typical implementation of the left outer join (ie. into x from y in x.DefaultIfEmpty() etc.) but am unsure how to introduce the oth...
hey guys, ok, here's the scenario:
VS 2008 .NET 3.5 SP1, LINQ to SQL.
I have a Product Entity, which has an ImageID field, so it has a relationship with the Image Entity. This is all defined in the schema and DBML.
Now, say I create a new Product entity, without a ImageID, and save it to the DB. At this point, the _Image field of the ...
Hello,
I am looking to develop a website for a news channel.
So, Obviously its gonna receive a lot of hits daily and will be updated a lot on daily basis..
I have experience in ASP.Net and SQL Server..
These are the technologies i am considering to work with. Please help me choose the right method considering the amount of load it w...
The only thing I can find when dealing with master/detail and LINQ is through databinding. However, I am using LINQ to query my data and will need to manually loop through results without the need for databinding. My final intent is to loop through a master result set, get a grouped list of children, and output the master/detail data as ...
I have a table with a column that has null values... when I try to query for records where that column IS NULL:
THIS WORKS:
var list = from mt in db.MY_TABLE
where mt.PARENT_KEY == null
select new { mt.NAME };
THIS DOES NOT:
int? id = null;
var list = from mt in db.M...
Scenario:
Trying to call the .AttachAll method on a table in my LinqToSql DataContext object.
Here's the relevant simplified snippet:
public void Update(Customer cust){
MyDataContext db = new MyDataContext();
db.CustomerInvoices.AttachAll(cust.Invoices); //exception raised here!
db.Customer.Attach(cust);
}
...
I've been working on a project where I have been using LinqToSQL that involved a lot of tables. All of these where mapped in one .dbml file (i.e. only one DataContext). I did this on the pretense that (currently) you cant join across multiple data contexts. For example...
DB1DataContext db1 = new DB1DataContext();
DB2DataContext db2 = n...
I just started learning Silverlight, and I'm wondering about the typical architecture of a Silverlight application and the workflow in the application (I'm using Silverlight 2, but will move to 3 any time soon).
In my test-application I currently only have the two default projects - MyProject and MyProject.Web. I'm familiar with the MV...
Here is my code:
partial void OnisApprovedChanging(bool value)
{
this.dateApproved = DateTime.Now;
}
'dateApproved' is updated in the business logic, but this change is not being applied to the database table. I've seen some examples where DateUpdated columns are updated whenever any edit to a table is made...
Hello,
I have to build a website for a news channel..
Please help me decide which technology to use for data operations?
1) Linq to Entities
2) Linq to SQL
3) Fluent NHibernate
4) ADO.Net
Website will be based on ASP.Net MVC and C#.
Main Issues:
1) Should be easy to maintain and scale.
2) Good Performance
Please express your vie...
I have 5 tables in a L2S Classes dbml : Global >> Categories >> Sub-Category >> Item >> Item Data. I want to be able to navigate from the Global table down a tree like structure to get to the items - displaying the title from the Item Data table.
I have an existing control that uses a IHierarchyData / IHierarchicalEnumerable extended co...
Is it just me or does changes produced by refreshing the LINQ DataContext not result in Changed Events?
I have a multiuser Application which has an simple atomar locking system to prevent conflicts.
So if an User changes something in the database I need to trigger Refresh on the Datacontext to reload the concerning objects.
A breakpoin...
Guys,
I am using LINQ2SQL and I have a table called Customers with three columns
CustmerID, CustomerCode, CustomerName
CustmerID is Primery Key(and Identity=yes) and CustomerCode is just UniqueKey.
When I am updating this table using LINQ to SQL with duplicate customercode, I expect to see DuplicateKeyException but it is going into t...