I'm using linq to sql. And do something like:
IEnumerable<VarValues> parameters = GetDayParameters();
protected IEnumerable<VarValues> GetDayParameters()
{
return "some linq query";
}
After that, i'm using LINQ to Objects for "parameters"-variable, in loop, and that queries start to connect to database.
Question is, can i force L...
I have a WPF Linq-to-SQL project which I have been developing using MS Visual Studio 2008. I was running SQL Server 2008, and recently upgraded it to version R2. Now, whenever I build my SETUP project (not the app itself), the build process causes a window to launch:
SQL Server 2008 R2 Management Studio
Please wait while Windows configu...
i had an error on a linq query when i tried to do SubmitChanges()
the problem is that what ever i try to do in my project now i'm getting the
same error (i guess the linq still tring to do the Error Change)
how can i clean the pendding changes or deal with that issue otherwise?
Thanx!
...
I've been trying to get the following method cleaned up using more sensible and lean syntax, but I'm striking serious headaches when it comes to aggregate clauses and filtering using L2S. Particularly, I feel I should be able to use a .Contains() method to filter out objects whose tags fit the string parameter passed in the method, but ...
Iam using .NET 3.5. I have asp.net mvc app. There is base controller:
public abstract class BackendController<TModel> : BaseController where TModel : class
{
// skipped ...
public ActionResult BatchDelete(int[] ids)
{
var entities = repository.GetList().Where(item => ids.Contains(item.ID));
repository.delete(entities)
}
...
Let's say I have a Person record in a database, and there's an Age field for the person.
Now I have a page that allows me to filter for people in certain age ranges.
For example, I can choose multiple range selections, such as "0-10", "11-20", "31-40".
So in this case, I'd get back a list of people between 0 and 20, as well as 30 to 4...
Right now I'm working my way thru the SportsStore exercise of Sanderson's "Pro ASP.Net MVC 2 Framework" book (page 107) and the exercise has me implementing a Repository pattern backed by a DB store using LINQ-to-SQL. I'm trying to figure out how to implement this same repository with the Subsonic ORM.
The basic repository code is as fo...
I've got a DBML file in my project with all my LinqToSql objects. Initially I imported them from the DB, and all was well. Now as my DB has been growing, I've been adding the new tables to the diagram in the O/R Designer, but they always get appended to the end of the XML. This is a bit of a pain, because when I'm defining foreign key...
I'm using Linq-To-SQL for a project with around 75 tables. We have to keep a cache of entire tables that we pull down because the entities are all interrelated and pulling them on demand takes way too long. So, to track all of these entities from all of these tables, we have a single class responsible for maintaining in-memory table refe...
I'm writing what I believe should be a relatively straight-forward Windows Form app. I'm using LINQ to SQL, though I have never used it before. We have a SQL Server database, and I'm creating a front-end to access that database. I'm trying to figure out the most efficient way to search for multiple (arbitrary number of) search parameters...
Hi -I have 2 entities -Offer and Share. Share stores the offers shared by users.
class Offer
int IDOffer;
bool Shared;
(other properties)
class Share
int IDOffer;
int IDUser;
where Offer.IDOffer = Share.IDOffer, 1-to-1 (users may share an offer only once, or not at all).
I extended Offer with the Shared property ...
I am rather new to the more modern ways of coding database persistence, and my intuition is telling me I probably am missing something because my code seems "inelegant" but I do not see another way to do it.
Note: I understand maybe Linq to SQL is considered "dead". I'm more in a "learning the concepts" mode assuming that I can probabl...
I have a LINQ expression that gets used as a filer in a LINQ to SQL statement where clause. My problem is that the LINQ to SQL expression has become unwieldy and also the logic it contains has ended up in multiple locations violating DRY (this is the 3rd time I'm working on a bug raised by QA for it getting out of sync).
Is there any wa...
i need to know best practice for avoid connection timeout when using LINQ to SQL in .net applications specially when returning IQueryable<T>from data access tiers or layers.
I get "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in us...
I have a simple table structure in SQL Server:
One table storing a list of Bikes (Bikes) and a second table storing a historical list of the bike's owners (Owners).
Using Linq 2 SQL I generated a model that gives me a 'Bike' entity with a 1 to many relationship to 'Owner' called 'HistoricalOwners'.
So far so good...
Now I have many q...
I've seen some discussion about L2S vs EF4 on Stack Overflow back in April, when VS2010 was launched, namely:
Dump Linq-To-Sql now that Entity Framework 4.0 has been released?
Is Entity Framework worth moving to for a new small app?
Now, after 6 months, presumably people have had more interacting with EF4, so I'm curious of fresh opin...
I am converting a project from using linq2sql to use an odata source. I am trying to lookup a user like this...
FrameworkEntities db = new FrameworkEntities(
new Uri("http://localhost/odata/FrameworkService.svc"));
User user = db.Users.Where(
u => SqlMethods.Like(u.UserName, UserName)).FirstOrDefault();
but am getting the erro...
I have a new project where I want to use MVC (I will be learning as I code), and I have never used linq or entity (or mvc). Which should I use? Does it matter?
edit: I will be having a lot of different databases, from Oracle to FoxPro.
...
Hi friends,
I have a self referential category table as you see:
I want to parse this table to find out tree level for each category. for example if root node level is 0 then CPU and Hard Drive and VGA and RAM are in level 1 and so on. how can I handle that?
I created a dictionary to put each category ID and its Level:
Dictionary<int...
I've written quite a long C# program using Linq to Sql and my data are stored in an MDF file located near my program's EXE.
A part of my program has a form for backing up the database files simply by copying the MDF and LDF files into a user-specified folder.
However if I query the database and then try to replace the original files wit...