linq-to-sql

Will linq to sql work in an asp.net 2.0 web application?

Will linq to sql work in an asp.net 2.0 web application? Just realized the server doesnt' support asp.net 3.5 (no control over it!) ...

How can I subsample data from a time series with LINQ to SQL?

I have a database table full of time points and experimental values at those time points. I need to retrieve the values for an experiment and create a thumbnail image showing an XY plot of its data. Because the actual data set for each experiment is potentially 100,000 data points and my image is only 100 pixels wide, I want to sample ...

Asp.net 3.5 still uses 2.0 compiler, so we just drop 3.5 dll's and it works?

Is it true that asp.net 3.5 still uses the 2.0 compiler, and because of this, we can use 3.5 features on a server that only supports asp.net 2.0 as long as we drop the required .dll's into /bin? In my case I need to use linqtosql on a server that only supports asp.net 2.0. (Client's decision, can't change this). ...

Linq to sql Repository pattern , Some doubts

I am using repository pattern with linq to sql, I am using a repository class per table. I want to know , am i doing at good/standard way, ContactRepository Contact GetByID() Contact GetAll() COntactTagRepository List<ContactTag> Get(long contactID) List<ContactTag> GetAll() List<ContactTagDetail> GetAllDetails() class Co...

Insert Custom value on Cell in ASP.NET Dynamic Data

I have a Dynamic Data linq to sql Website where I need to assign values on an specific cell in the insert or update pages. I have tried in the pageload of the Edit template table.Columns[1].DefaultValue = User.Identity.Name; but as is a metatable it is readonly. Help... ...

Arguments for moving from LINQtoSQL to Nhibernate?

Backstory: Hi all, I just spent a lot of time reading many of the LINQ vs Nhibernate threads here and on other sites. I work in a small development team of 4 people and we don't even have really any super experienced developers. We work for a small company that has a lot of technical needs but not enough developers to implement them (and...

How to avoid loading a LINQ to SQL object twice when editting it on a website.

Hi guys I know you are all tired of this Linq-to-Sql questions, but I'm barely starting to use it (never used an ORM before) and I've already find some "ugly" things. I'm pretty used to ASP.NET Webforms old school developing, but I want to leave that behind and learn the new stuff (I've just started to read a ASP.NET MVC book and a .NET...

Linq2Sql How to write outer join query?

Hi, I have following SQL tables. ImportantMessages impID Message ImportantMessageUsers imuID imuUserID imuImpID I want to write a Linq2Sql query so that it returns any rows from ImportantMessages that does not have a record in ImportantMessagesUsers. Matchiing fields are impID ----- imuImpID Assume imuUserID of 6 ...

Updating Many-to-Many relationship with LinqToSQL

If I had, for example, a Many-to-Many mapping table called "RolesToUsers" between a Users and an Roles table, here is how I do it: // DataContext is db, usr is a User entity // newUserRolesMappings is a collection with the desired new mappings, probably // derived by looking at selections in a checkbox list of Roles on a User Edit pa...

Constructor or Explicit cast

In working with Linq to Sql I create a seperate class to ferry data to a web page. To simplify creating these ferry objects I either use a specialized constructor or an explicit conversion operator. I have two questions. First which approach is better from a readibility perspective? Second while the clr code that is generated app...

refactor LINQ TO SQL custom properties that instantiate datacontext

I am working on an existing ASP.NET MVC app that started small and has grown with time to require a good re-architecture and refactoring. One thing that I am struggling with is that we've got partial classes of the L2S entities so we could add some extra properties, but these props create a new data context and query the DB for a subset...

c# finding matching words in table column using Linq2Sql

I am trying to use Linq2Sql to return all rows that contain values from a list of strings. The linq2sql class object has a string property that contains words separated by spaces. public class MyObject { public string MyProperty { get; set; } } Example MyProperty values are: MyObject1.MyProperty = "text1 text2 text3 text4" MyObje...

Database table relationships: Always also relate to specified value (Linq to SQL in .NET Framework)

I really can not describe my question better in the title. If anyone has suggestions: Please tell! I use the Linq to SQL framework in .NET. I ran into something which could be easily solved if the framework supported this, it would be a lot of extra coding otherwise: I have a n to n relation with a helper table in between. Those tables...

How to dynamically choose two fields from a Linq query as a result

If you have a simple Linq query like: var result = from record in db.Customer select new { Text = record.Name, Value = record.ID.ToString() }; which is returning an object that can be mapped to a Drop Down List, is it possible to dynamically specify which fields map to Text and Value? Of course,...

Why should I use Entity Framework over Linq2SQL ...

To be clear, I am not asking for a side by side comparision which has already been asked Ad Nauseum here on SO. I am also Not asking if Linq2Sql is dead as I don't care. What I am asking is this.... I am building internal apps only for a non-profit organization. I am the only developer on staff. We ALWAYS use SQL Server as our Datab...

Using multiple databases within one application

I have a web application made for several groups of people not connected with each other. Instead of using one database for all of them, I'm thinking about making separate databases. This will improve the speed of the queries and make me free from checking to what group the user belongs. But since I'm working with LINQ to SQL, my clas...

Timestamp as part of composite primary key?

I get this error when using linq-to-sql with timestamp as part of a composite primary key: "The primary key column of type 'Timestamp' cannot be generated by the server." I'm guessing this may be due to the fact timestamp is just a row version thus perhaps it must be created after the insert? Or... ...

ASP MVC LINQ to SQLtransaction rollback

I know that LINQ to SQL automatically wraps all changes in a database transaction. So if I wanted to use the returned ID for another insert (my user table has an AddressID, so I add a new Address record and then add a new user record with that ID) and there was a problem inserting a user, the address insert would not roll back. Should yo...

Subsonic 3.0.0.4 Does not Update

I tried 3 variants but doesn't seem to update (I am using Linq Templates and MSSQL) Luna.Data.GameDBDB db = new Luna.Data.GameDBDB(); db.Update<Luna.Record.TB_ITEM>() .Set(x => x.ITEM_DURABILITY == Convert.ToInt32(quantity)) .Where(x => x.ITEM_DBIDX == Convert.ToInt32(dbdidx)) .Execute(); Here is the o...

Immediate Loading Not Happening With Take Operator

I am running the following code NorthwindDataContext db = new NorthwindDataContext("Data Source=(local);Integrated Security = true;Initial Catalog=Northwind"); IQueryable<Customer> allCustomers = db.Customers.Take(2); db.Log = Console.Out; DataLoadOptions opt = new DataLoadOptions(); opt.LoadWith<Customer>(cust =...