linq-to-sql

Linq dbml show int return type for an SP which SP return some fields from temporary table.

I have written a Stored procedure which return some fields from a temporary table which i create in this stored procedure. but when I include it in my dbml file it show return type of my stored procedure as int. which should be not as am returning field from table although its temporary. ...

What's problem on linq databinding

<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" KeyFieldName="CategoryID"> <SettingsEditing Mode="Inline" /> <Columns> <dx:GridViewCommandColumn VisibleIndex="0"> <EditButton Visible="True"></EditButton> <NewButton Visible="True"></NewButton> <DeleteButton...

Lose databinding possibilities with UoW pattern in Linq to Sql

I'm currently working on my first Linq-to-Sql app. I've implemented the data-access methods with a short dataContext lifetime like this: public IProduct GetByCode(string code) { using (var db = new dataContext()) { return db.Products.SingleOrDefault(e => e.Code == code); } } I'm wondering how to get change notif...

ASP.NET MVC - Is there an easy way to add Data Caching to my Service Layer?

I've got my MVC application wired up so that the Repository Layer queries the LINQ to SQL classes, the Service Layer queries the Repository Layer, and the Controllers call the Service layer. Basically I have code as follows Repository Public Function GetRegions() As IQueryable(Of Region) Implements IRegionRepository.GetRegions ...

Getting Xml Columns from LinqDataSource to appear in a GridView

I have a LinqDataSource and a GridView displaying a table. Columns of type xml don't show up. I'd like them to show up something like they do in Sql Server query outputs, with a link to display the clickable xml, though there may be another approach i'm not considering (maybe a styled display of the xml data, etc.). Two things i'd like t...

Is there any way to serialize ChangeSet class from MyDataContext.GetChangeSet() method

Is there any way to serialize ChangeSet class from MyDataContext.GetChangeSet() method, or how to get sql commands for all changes in ChangeSet? ...

how to insert data in sql table using Linq without seting any primary key in table

I have a Table in which i don't want to specify any primary key, after that i am inserting records in it using Linq...aahhh...its giving the error "Can't perform Create, Update or Delete operations on 'Table(abc)' because it has no primary key" can ani one tell me how to insert record without setting it primary key. By the way im not s...

LINQ Grouping: Select row instead of key?

I probably won't be able to explain this well enough, but here it goes... I have a table similar to this: Id | Foreign_Key_Id | A_Number | Some_Other_Info 1 1 100 Red 2 1 200 Blue 3 1 300 Orange 4 2 100 Green 5 2 ...

Speed up page loading and information processing

On my web application I'm loading a page which can load up to 8000 or more rows in a table, each row having its own dropdownlist. This first process proves to be extremely inefficient but I was asked to do it like this. The code loading the rows goes below: <tbody> <% var i = 0; foreach (var row in Model) ...

Linq to sql and timestamp field

I've created table with timestamp field. Allow Nulls property is set to false. When I want to update entity from repository, I get null value for that field, but in databse this field is set to some value. Does anyone knows what may be the problem? I get the correct values for other fields. Thank you. edit: When I get entity from the re...

DBML: s letter added to my table names

I'm using Visual Studio 2008 Each time I modify my dbml through the designer some of the table names in the designer.cs file are changed from TableName to TableNames leading to some reference errors in the rest of the project. The names that appear on the dbml are not changed. Where does this come from ? Is it a setting ? Edit: It ha...

Rules Violations Exceptions in LINQ ASP.NET MVC

Possible Duplicate: First attempt at Linq to Sql in NerdDinner - Rule violations prevent saving Hello, I am using ASP.NET MVC application with LINQ and when I try to SubmitChanges after Inserting a table data I am Getting "Rule violations prevent saving". I am doing UpdateModel before submitting but that passes fine. I doub...

Optimize Linq to SQL query, Group By multiple fields

My LINQ query contains the following Group By statement: Group p By Key = New With { _ .Latitude = p.Address.GeoLocations.FirstOrDefault(Function(g) New String() {"ADDRESS", "POINT"}.Contains(g.Granularity)).Latitude, _ .Longitude = p.Address.GeoLocations.FirstOrDefault(Function(g) New String() {"ADDRESS", "POINT"}.Contains(g.Granularit...

Model binding issue in LINQ to SQL

I am just now starting to work with LINQ, and am pretty familiar with MVC. I have a strongly typed view that is updating a record. I have successfully done a creation: This works fine, and creates a record in the database: public ActionResult Create(TABLEMODEL tableModel) { DBDataContext db = new DBDataContext(); if (ModelState...

Does Linq to SQL designer support foreign keys with compound primary keys?

The linq to sql designer is not generating the property for one of the associations of my model, the only difference between this association and other associations is that this one references a 5 column primary key, could this be the problem? ...

Is there a library to use Linq to directly query databases, dynamically?

I have a very dynamic SQL Server problem to solve. I am developing a tool that verifies matched data in multiple databases. [NOTE: the requirements on this project are pretty strict] I need to make a C# tool that lets a user select any database from a dynamic list, then lets the user select a table (acting as a source db/table). Once th...

Image retrieval optimisation with LINQ

Hi, I'm working on optimising the image retrieval from the database with LINQ. The approximate image size is 4000 * 1000 pixels which weighs about 400-600KBs. The images are retrieved through a controller which is being called by a webservice. Web service gets called through jQuery. The first image that gets retrieved in about 0.7 - ...

Why linq LinqServerModeData not working?

I work on Northwind database <dxwgv:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" DataSourceID="LinqServerModeDataSource1" KeyFieldName="CategoryID"> <Columns> <dxwgv:GridViewCommandColumn VisibleIndex="0"> <EditButton Visible="True...

In linq how to work on Storprocedure

I work on Northwind database.server MS2008.In linq i active a sp then show me the bellow error: Syntax : <dxwgv:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" DataSourceID="LinqServerModeDataSource1" KeyFieldName="CategoryID"> <Columns> <dxwgv:GridViewCom...

Is it still benefitial to think about NHibernate for .Net while there is LINQ to SQL possibility?

Hi, I am not very familiar with both LINQ to SQL and NHibernate. As far as I understand LINQ to SQL is a kind of replacement of NHIbernate for .Net in many ways. So does this mean that LINQ to SQL is a built-in replacament of NHibernate which let's a .Net developer to skip NHibernate and start to work with LINQ to SQL? Thanks ...