I had asked this question in a much more long-winded way a few days ago, and the fact that I got no answers isn't surprising considering the length, so I figured I'd get more to the point.
I have to make a decision about what to display a user based on their assignment to a particular customer. The domain object looks like this vastly ...
I found the MSDN quickstart guide, but it's a bit lacking in explanation and other useful things.
Do you know where I can find a good tutorial for someone somewhat familiar with Linq-to-SQL but interested in EF?
...
I'm working on a project where most of the times I'm going to call database with a stored procedure and I'm a little bit confused what should I do. Options are not just restricted to Sql to Linq and EF. If there are any better options please suggest them too.
UPDATE - Reason for using SPs
I've to apply logic in many of the stored proced...
Hi ,
I have some methods in my BLL that fetch some records from database and pass it to UI for binding to Data Controls such as Gridview or ...
I could choose my return data type of the methods whether IQueryable<t> or Ilist<t> .
My question is which one would be better for me and why ?
Actually i don't know the difference between t...
Hi folks
I'm trying to refactor a query that currently uses reflection:
var dbObjects = from d in collection
where d.GetType().GetProperty("Id").GetValue(d, null) == id
select d;
I would like to use dynamic typing to access the property Id on "d" without knowing what type "d" is at compile time.
Something like this:
var db...
Here is my object association:
Summary
-> Job
-> Operator
-> Job
-> Operator
So, I have a Summary object that contains a collection of Jobs, which has an Operator object (clock #, name, etc)
When creating a new summary, I go through and create the new jobs that exist and add all the properties. Then, do a single insert on the Su...
I have one specific view created in my DB(joins about 5-6 tables with a left join).This view is added to my edmx (entity framework 1.0) . Recently I noticed that one of the column records obtained using the edmx (linq to entities and then ToList()) got duplicated multiple times though in the database view they were different
Column-N (E...
I'm using .NET 4 and I'm just wondering if there is an optimized way of achieving the following.
Public Function GetUserByOpenID(ByVal claimedidentifier As String) As User Implements IUserRepository.GetUserByOpenID
Dim user = (From u In dc.Users
Where u.ID = (From o In dc.OpenIDs
...
I know we cant use space in alias names when graming a LINQ 2 SQL expression.I am trying to bind the result to a datagrid in my WPF page.so now the column header are what i gave in the Alias.I just want to rename it to some thing else (Ex : From ItemName to Item Name )
The code which i have
Dim items = From p In objDB.ItemDetails Wher...
I am getting a ChangeConflictException when I try to SubmitChanges using my DataContext. The submit is attempting to do 8 updates with each update being only a single field in the record. When I catch the exception, I have looked at the .ChangeConflicts and there are 8 of them, but here's the weird thing, the .MemberConflicts of each c...
So, In my old Linq-To-SQL I would write code like this
var tableItem = new Table
{
Prop1 = var1
Prop2 = var2,
Prop3 = var3,
ParentTableID = parentRecordID
};
db.Table.InsertOnSubmit(tableItem);
db.SubmitChanges();
After converting my working code from Linq-To-SQL to Entity Framework (v3.5) the ParentTableID property i...
I am trying to create a LINQ to SQL query and am really stumped.
I have a database with multiple tables and can create a query that successfully returns the result from a single join. The problem I am having is introducing the second join.
The SQL statement was easy enough to generate
USE InlandMarina
SELECT *
FROM Slip s LEFT JOIN ...
I get a LINQ object from MVC2 that I want to update to the database. My current code looks like this:
public PersonTbl Save(PersonTbl item)
{
if (item.ID == 0) //new item
{
_dbContext.PersonTbls.InsertOnSubmit(item);
}
else
{
var item2 = _dbContext.PersonTbls.S...
I'm working on a simple SQL View which has a field called DispatchNote of type varchar.
Here is what I needed to do:
Filter this view so that we only have rows in which the value of DispatchNote is convertible to int.
Afterwords, I need to query this view again and filter it using a between clause, like so:
SELECT *
FROM ViewDispatchNot...
Hi,
I have SQL 2008 server with tables Employee, Phone and Email where Employee is in a one-to-many relation with Phone and Email (So employee can have many phone numbers and emails).
Now I want to query employee with all phones and emails:
var query = (from e in db.Employee
select new EmployeeDTO
{
...
Hello all, I am trying to translate this:
SELECT IDNum, Max(Convert(varchar(20), (TimeOut - TimeIn), 108))
FROM IO_Times Group by IDNum
order by Max(Convert(varchar(20), (TimeOut - TimeIn), 108)) desc";
Into LINQ in C#. The above returns a list of the maximum value of (TimeOut-TimeIn) that corresponds to each unique ID...
I have a selection list that is generated dynamically, it lists a number of checkboxes that are based on an end-user editable table, as such I have no idea what data, or how much, might be contained in this table and how many checkboxes or what they might contain, other than the primary keys of the table.
The user will select the checks...
In .NET 4.0 and Linq to SQL, I am trying to use a partial class to "trigger" changes from within an update method (an existing DBML method). For simplicity, imagine a table Things with columns Id and Value
The auto gen DBML contains a method OnValueChanged, I'll extend that and as an exercise try to change one value in one other row :
...
I am a newbir to LINQ 2 SQL and needs help to create left join query.
I have the below LINQ 2 SQL query to get data from 2 tables.Now i want to LEFT join one more table to this .A column called "SerialId" is associated with SerialId column in "IV00200s " table
Dim items=(From i In oRecelDB.IV00200s From c In oRecelDB.MDS_CONTAINERs.Wh...
Hello all, I am trying to output a table of IDNums + Name + Max(TimeOut-TimeIn). I only want the maximum time change value for each ID since there are multiple time entries per ID. I have that so far. However, the Name associated with the ID is in a seperate table. Here is what I tried:
from IO_Time in db.IO_Times
join NameTable in db.N...