Background:
I have a web application for which I need to do database auditing for insert/deletes/updates (and maybe reads). I use LINQ as my ORM. Using some ideas I found on the web I've come up with a way of using attributes to decorate my entities which have associated audit tables. The audit table itself is required to include th...
I've written an app that I use as an agent to query data from a database and automatically load it into my distributed web cache.
I do this by specifying an sql query and a type in a configuration. The code that actually does the querying looks like this:
List<Object> result = null;
try { result = dc.ExecuteQuery(elementType, entry.Com...
Hi. I feel the answer to this may lie with delegates, but I am having a hard time grasping the concept of delegates. The main problem is that every explanation and example of delegates I have ever read are always round about ways of doing something you could accomplish without delegates so to me it does not teach me anything. I learn bes...
I am looking to learn Linq to query MS SQL databases, but am unsure of which path to take. I read recently that Linq to SQL is being rolled into Entity Framework, and development has maybe stagnated.
Is it worth learning Linq to SQL still? Or should I be focusing on Entity Framework or another Object Relational Model like Ideablade's De...
I've just started using LINQ to SQL on a mid-sized project, and would like to increase my understanding of what advantages L2S offers.
One disadvantage I see is that it adds another layer of code, and my understanding is that it has slower performance than using stored procedures and ADO.Net. It also seems that debugging could be a cha...
I'm looking for some statistics on the usage/popularity/availability/etc of object relational mapping frameworks (ORMs).
An example might be how the number of downloads of a specific ORM has changed over time.
Does anyone know of any such statistics?
Edit:
A little clarification: The reason I want the statistics is to be able to back ...
How can I change the class name of stored procedure result generated by LINQ to SQL designer (besides messing with designer.cs)?
Also, how can you perform a linq query on the result set of the stored procedure?
...
When I write a code like below, I take this error message: "The query operator 'ElementAtOrDefault' is not supported."
How can I fix it?
Dim tmpQuestion As New UIData
Dim strViews = From t In tmpQuestion.LU_QUESTIONs _
Where t.ID_QUESTION = Request.QueryString("IdQuestion") _
Select t
...
I have created an extensibility method for deleting one of my Linq To Sql objects called Reservation.
Well, in this partial method I created, I want to update some other objects. I can't seem to get the update to be persisted in the database. Here is my partial method for deleting the reservation.
public partial class LawEnforcementDat...
I've been trying to encapsulate the object mapping in a projects data repository. Perhaps EF will provide the level of abstraction required but for a range of reasons I am using Linq to SQL at the moment. The following code aims to return the users in the database as a list of ModUser objects, where ModUser is POCO that the repository ex...
Hi everyone,
I'm trying to map my inheritance hierarchy to DB using Linq to SQL:
Inheritance is like this, classes are POCO, without any LINQ to SQL attributes:
public interface IStage
{ ... }
public abstract class SimpleStage<T> : IStage where T : Process
{ ... }
public class ConcreteStage : SimpleStage<ConcreteProcess>
{ ... }
He...
I've noticed as soon as I added joins to some of my queries the time it took to execute these was more than just completing multiple queries.
Times include page load and averaged over 20 page loads.
7-9 queries with no joins
159ms
3 queries with 2 joins
235ms
Should I just go ahead with multiple queries instead of the joins conside...
Hi,
I got a linq query. I wanna take this query results to a dataset. How can I do this ?
var variable = from t in db.Islems
where t.Tarih >= dateTimePicker1.Value
&& t.Tarih < dateTimePicker2.Value
select t;
DataSet ds = new DataSet();
I wanna load the query results to the dataset,...
I just started using Linq to SQL, and it just occurred to me that I don't really need any sprocs in the database since i can do all the data access through Linq to SQL.
Is there any reason to write sprocs with Linq to SQL?
Thank you.
...
I just started learning LINQ2SQL and one of the first things I wanted to try is a simple parent-child hierarchy, but I can't seem to find a good way to do it. I saw some examples here on SO and i've googled, but I couldn't apply them directly, so I'll explain exactly what i'm trying to accomplish.
Lets use the common example with tags.
...
I'm looking for an ORM that offers complete or near-complete LINQ support.
LINQ to SQL
- Supports about everything inside of LINQ (.Contains, Math.Log, etc)
- Cannot eager load relationship properties without creating a new datacontext
ADO.NET Entity Framework
- Terrible LINQ support (lots of missing features).
- Great mapping features...
The Setup:
I have a large form with many fields that are collected to update a Product object. So in the ASPX page the user changes the fields that need updating and they hit submit. In the code behind I do something like this;
Dim p as New MyCompany.Product()
p = p.GetProductById(ProductID)
I extend the Product partial class of Li...
Hi,
I have a page that displays two objects and then the user picks one of these. I record the preference and the combination in a MSSQL database and end up storing data like this:
UserId=1, BetterObjectId=1, WorseObjectId=2
Now I would like to avoid showing that combination of objects (1,2 / 2,1) ever again.
So how do I generate ra...
I have a time field in a mssql 2008 database that I want to do something to the effect of:
Timespent = x.sum(x => x.AmountOfTime);
Where AmountOfTime is a time MSSQL field. Sum seems to only work on decimals, how can I add these columns?
...
I have been utilizing Scott Gu's tutorials on LINQ to SQL to try to learn some LINQ. I have been able to view, retrieve, and update records but I am unable to write new records into the database (MSSQL). Scott starts getting into inserting rows in the fourth section of the set of tutorials. As you can see on that page (or may already kn...