linq-to-sql

removing table prefix in linq2sql setup

All my tables are prefixed with xx_ Is it possible to globally remove this and make the first character upper case? ...

Single vs. multiple Linq2sql repositories

I have a Users table, Events table, and a mapping of UserEvents. In some parts of my code, I just need user-based stuff. In other parts, I need all of this information. (Especially: given a user, what are the details of each event they are subscribed to?) If I have one repository just for users and another for users + events + userevent...

how to update my linq to sql setup when db changes?

I changed my db model, now I need to update my linq setup. How do I do that? btw, I renamed all the databases in the designer so I can't just drag and drop it again. ...

Relational database tables

Hello, I'm currently working on an ASP.Net MVC project for a software engineering class. My goal is to create a small online game rental system. I currently have a 3 tables, Movies, Games and Registrants; and I'm using LINQ-to-SQL to define each of these tables as classes for my model. So far I've created models for Movies and Games, ...

LINQ vs datasets - performance hit?

I am refactoring an existing VB.NET application to use Linq. I've been able to successfully get it to work, but it takes ages (over a minute) on the client machine! They have lots of rows in the database table, but the old version of the programme on the same machine (which uses Datasets) takes 5 seconds. My Linq queries are pretty st...

How do I do this with LINQ?

I'm not entirely sure if I'm trying to do something a little too complex for this but what I essentially want to do is turn this: declare @callid int set @callid = 57 declare @update nvarchar(max) declare update_cursor cursor for select UpdateIdentity from [Helpdesk_HR].[dbo].[hdEvents] where CallID = @callid group by UpdateIdentity or...

LINQ to SQL bug (or very strange feature) when using IQueryable, foreach, and multiple Where - continued

I have a question closely related to the scenario described here: http://stackoverflow.com/questions/293216/linq-to-sql-bug-or-very-strange-feature-when-using-iqueryable-foreach-and-mul I have a similar problem but in my case the correspondance to the filter list is a List of IQueryables of int's and I get the same type of problem. In m...

LINQ: Get Table Column Names

Using LINQ, how can I get the column names of a table? C# 3.0, 3.5 framework ...

Simple linq question: How to compare in query with the last of antoher table

Hi guys, I want to compare a table coloum with the last entry of another (by foregn key given) table. And then fobit the entry, when it's the last. So: Table 1 - Coloum userid - value: 1000 Table 2 . Coloum userID - value: 1000 // Coloum rowID: 1 Table 2 . Coloum userID - value: 2000 // Coloum rowID: 2 Table 2 . Coloum userID - val...

Adding/Editing master-children entities in a single Windows forms

How would you go about designing a windows form that allows adding/editing a master entity along with it's child entities? For example When adding/editing an Order, Order-Items would also need to be added/edited on the same Windows form. ...

LINQ2SQL + PLINQO: How does one handle a simple situation like this?

Hello, I’m new to PLINQO, I’m fairly new to LINQ2SQL and I’m adding a new DAL (called DAL2) in parallel with our old existing DAL. Our idea is to start using linq2sql for every new thing we add and slowly start moving old DAL usage to the new DAL2. As we all know, DLINQ is nice for simple things but in more complicated scenarios (many...

Why does LINQ-to-SQL not create singular class for table named "ApplicationMenus"?

When I generate LINQ-to-SQL classes for a table named ApplicationMenus it doesn't create a singular class for it so that the statement: ApplicationMenu applicationMenu = new ApplicationMenu(); gives an error. If I change the name of the table to one of these: Menus ApplicationMenuItems then it correctly generates the singular clas...

Using Custom SQL Queries with LINQ to SQL... Help

I have followed this tutorial by Scott pretty much to the T against my own database. http://weblogs.asp.net/scottgu/archive/2007/08/27/linq-to-sql-part-8-executing-custom-sql-expressions.aspx I am getting an error in my Partial class. The name 'ExecuteQuery' does not exist in the current context. I cannot for the life of me figure ou...

Linq to SQL: Replacement for DataLoadOptions.LoadWith?

Hi guys, I have 2 table, 1-to-x. Every time I load the x-table with... DataLoadOptions options = new DataLoadOptions(); options.LoadWith<Auktion>(a => a.Artikel); my performance lose is killing me. Without the DataLoadOption my query runs ~30ms. With the Option it runs ~400ms by 1-to-30 data rows. (I get a single row from tabl...

Can I do this with an IQueryable<T> ?

Hi folks, is it possible to add an extension method to IQueryable<T> and then, for my Linq2Sql or EF or NHibernate or LinqToObjects, define it's functionality / how each repository will impliment this method / translate this method to some sql? For example, imagine I want the following :- var result = (from q in db.Categories() ...

How to display records in the listview control?

Hi everyone! I'm trying to use listview control in vb.net or vb2008 express edition to display records from my database after it is being queried.I have two column headers in my listview control which are named Account# and Authorized Users. I was able to display the records from the database into the listview control but i don't know h...

LINQ to SQL Generic Class for Insert and Delete operation

Hi, I have been writing same code for insert, update, delete with LINQ over and over again. I want to have some sort of generic function for Insert, Update, Delete operation. I read a post here like the following : public static void Insert<T>(T entity) where T : class { using (OrcasDB database = new OrcasDB()) { databa...

How to reconnect to a lost connection when it is lost using Linq to SQl automagically

i don't want to encapsulate every call in a try catch block is there an event i can subscribe to, for when a connection is lost or timesout so that i can reconnect.. or some way to not check every linq query. and if not why not! Edit: Does Linq to Entity's have this? Edit: I'm using Microsoft SQL Azure, and it drops connections alo...

Linq query across three levels of tables to generate sum

I have a series of tables that are joined with Primary Key/Foreign Key relationships. I have a table of Transactions, and each Transaction references one and only one Product. Each product can exist in one and only one Category: Categories Products Transactions ------------- ------------- ----------------- ...

DataGridView Row Click to Linq Object

I'm a beginner with C# so I made a little app, to figure out how to work with Linq and databased in C#. What I'm trying to do is in a DataGridView when someone clicks a row containing some data I want to go from e.RowIndex to a Linq object of the data in that row, my attempt involved using the DataBoundItem. But for whatever reason th...