Does anyone know of a way to do something similar to Django's signals using LINQ to SQL?
I'm trying to record when new rows are inserted and when certain columns are updated, so I really just want pre_save and post_save signals.
I can kind of do it with some models by using the partials defined like OnFooIDChanging() and OnFooIDChanged...
Hello all,
I have a strange problem when deleteting records using linq, my suspicion is that it has something to do with the range variable (named source). After deleting a record all targets for a customer are retrieved using the following statement:
var q = from source in unitOfWork.GetRepository<db_Target>().Find()
where source.db...
If I inherit one DBML file from another DBML file, is it possible to visually create associations to the data classes from inherited DBML?
...
I have
OrgUnits,
OrgUnitJobs,
Employees,
OrgUnitJobEmployee (this one may seem redundant in this context, its here fyi)
tables.
org units have jobs defined in OrgUnitJobs (1..n)
employee (can also have many jobs) has jobs defined in OrgUnitJobEmployee table.
and employee has a PrimaryJob (1..1) in OrgUnitJobs table, so how d...
I have a DAL that is composed of a bunch of methods that perform LINQ queries on my database.
How do I ensure that before returning say an IEnumberable or something similar from the database, I ensure that the LINQ query is execute then, not in some delayed fashion only to be executed when the result is used?
I know I can call .ToList(...
Ok, the short version is that I have a Linq entity from a LinqDataSourceUpdateEventArgs and I need to handle the Update manually because MS was stupid.
I can get the Table object from the data context, which allows me to, well, this:
var newObj = e.NewObject;
var table = FormContext.GetTable(e.NewObject.GetType());
table.Attach(newOb...
In a SQL Server 2008 database, I have a table with a column of type varbinary.
Currently, I am using LINQ to SQL to access the database.
I already know that I can delay the loading of the column. However, I wish to consume less memory by not loading all of the bytes from that value.
Ideally, I would like to have a Stream to those bytes.
...
I currently use the 3-layer architecutre (DAL, BLL, Presentation Layer).
I am wondering how I can implement the 3 layers architecture using LINQ to SQL. I don't know whether LINQ should be in DAL or BLL. LiNQ seems the fusion of both DAL and BLL.
Does anyone implement LINQ in 3-layer architecture before?
...
Hi:
I am using Asp.Net MVC. in my project while uploading PDF file we convert the PDF file into byte then store it in DB. but i got the following exception.
" String or binary data would be truncated.
The statement has been terminated."
Can any one solve this issue.I got the exception righ here
context.SubmitChanges();
Tha...
I have two tables for tracking user sessions on my site. This is a gross oversimplification btw :
Campaign:
campaignId [int]
campaignKey [varchar(20)]
description [varchar(50)]
Session:
sessionDate [datetime]
sessionGUID [uniqueidentifier]
campaignId [int]
campaignKey [varchar(20)]
...
SELECT P.ProductId, P.ProductCategoryId, P.ParentProductCategoryId,
P.ProductName, PC.Name AS Category, P.Price, P.ProductYear
FROM dbo.ProductCategory AS PC
INNER JOIN
(SELECT dbo.ProductCategory.ParentProductCategoryId,
dbo.ProductCategory.ProductCategoryId,
dbo.ProductCategory.Name AS CategoryName,
...
Given the premise:
There are competent sql programmers
(correlary - writing sql queries are not an issue)
There are competent application developers
(correlary - there is simple/strong/flexible architecture for handling connections and simple queries from code)
Why do people use linq to sql?
There is overhead added to each transact...
I'm using DbLinq which should be the equivalent of Linq2SQL for this question. I'm need to generate a Linq2SQL query where I specify the columns I want returned at runtime. I can achieve that using the Dynamic Linq extension methods but I can't work out how to extract the result.
string someProperty = "phonenumber";
string id = "1234";
...
I'm having performance issues with Linq2Sql compared to raw ADO.NET which has led me down the path of compiled queries. I have got this far so far
public static readonly Func<MyDataContext, WebServices.Search.Parameters, IQueryable<image>>
Compiled_SelectImagesLinq =
CompiledQuery.Compile<MyDataContext, WebServices.Search.P...
Hey,
I'm trying to write a linq to sql method that handles sorting, paging, and filtering for an ajax grid. I created a partial class Employee that has a TotalRecordCount, as I need to pass this to the javascript for setting up the pager. The problem is that it won't build because I can't set the AnonymousType#1.TotalRecordCount, it's re...
When will linq to sql be phased out? Is entity frameworks (replacement) released yet?
...
I have recently written a LINQ query to get a Dictionary containing the last 6 month's placement amounts.
It is returning a Dictionary of Month string - Decimal Amount pairs.
It seems kind of cludgey. Any of you LINQ masters out there able to help me refactor this to make a bit cleaner?
/// <summary>
/// Gets the last 6 months of Pla...
I am using LINQ to SQL with stored procedures in SQL Server 2008. Everything work well except one problem. L2S cannot generate the method for the stored procedure with user defined table type as parameter.
Method signature in dbml design panel use object for parameter type instead of table type and when I tried to compile I got error:
...
I'm experimenting some difficulties trying to use Connection String Builders (ADO.NET) within LINQ to SQL. Let me show you guys what I'm trying to do:
the app.config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="LoremIpsum"
...
I'm using LINQ to SQL, and having a bit of an issue incrementing a view counter cross-connection.
The teeny bit of code I'm using is:
t = this.AppManager.ForumManager.GetThread(id);
t.Views = t.Views + 1;
this.AppManager.DB.SubmitChanges();
Now in my tests, I am running this multiple times, non-concurrently. There are a total of 4 c...