I am receiving the following exception trying to browse a medium trust ASP.NET MVC application (using Linq-to-SQL) on Cassini 3.5.0.2:
Could not load file or assembly 'Cassini, Version=3.5.0.2, Culture=neutral, PublicKeyToken=da0fefd60d522a7d'
or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x...
Here is the revelant code.
TournamentTeam newTeam = new TournamentTeam();
TournamentTeams.InsertOnSubmit(newTeam);
SubmitChanges();
TournamentParticipant newSignup = new TournamentParticipant
{
CheckedIn = false,
TournamentID = tournamentId,
UserID = participant...
I'm building up a query using LINQ to SQL and C# and when I inspect the final T-SQL that is built the where clause looks like this:
WHERE ([t0].[T_SUBJECT] LIKE @p0) AND ([t0].[T_SUBJECT] LIKE @p1)
The structure of the T-SQL looks correct and I can test it using SQL Server Management Studio (SSMS) but in the code it's not working. I'd...
Is it possible to get Linq2Sql to emit a NOLOCK in its SQL? And if so, how?
Kind regards
Scott
...
Hello,
Here is my problem.
I'd like to get the last inserted Id with a custom sql expression in Linq To Sql.
My insert method:
public int Add(string Label)
{
_dbContext.ExecuteCommand("INSERT INTO Products (Label) VALUES (@Label);", Label);
_dbContext.SubmitChanges();
var lastId = _dbContext.ExecuteQuery<int>("SELECT Sco...
I'm new to Linq to Sql, what I would like to achieve is to create a single read only property on the Entity class that is a combination of multiple fields, specifically I want to create a name field that combines- title, forename and surname.
I can see how to do it by changing the .designer.cs file but know I'm not supposed to touch tha...
Hello,
I'm using LinqToSQL, creating my entities with the designer in studio which nicely creates the designer class with all corresponding entity-classes. Normally when I wanted some custom stuff added to my entities, I would create a partial class and do the custom stuff there.
Here's my problem; the new ASP.NET MVC 2 (preview) contain...
I have a table with server names and logins. I need to retrieve the logins that are common across a group of servers.
Given the following data:
ServerName Login
-------------------------------
Server1 User1
Server2 User1
Server2 User2
I would pass in Server1,Server2 and get back only User1 as User2 is not associ...
Using LINQ TO SQL as the underpinning of a Repository-based solution. My implementation is as follows:
IRepository
FindAll
FindByID
Insert
Update
Delete
Then I have extension methods that are used to query the results as such:
WhereSomethingEqualsTrue() ...
My question is as follows:
My Users repository has N roles. Do I create...
I am using Linq to Sql with Predicate Builder and am trying to optimize how much information is retrieved from the database. I would like to select only certain fields to display them in a gridview. When I select only what I want, the search parameters I add (see below) don't work, and neither does PredicateBuilder. Here's what I'm cu...
Linq-To-Sql enables calling SPs. If this SP executes an update/delete/insert, do I need to SubmitChanges() after it?
...
Hello
I've been googling around on L2S inheritance, and I think I have a fair idea of the limitations/what I have to do, but just looking for some confirmation from the community.
I have a REAL BASIC setup here:
public abstract class BusinessObject
{
public int Id { get; set; }
}
[Table]
public class Customer: BusinessObject
{
}
...
We've found that compiling our Linq queries is much, much faster than them having to compile each time, so we would like to start using compiled queries. The problem is that it makes code harder to read, because the actual syntax of the query is off in some other file, away from where it's being used.
It occurred to me that it might be ...
I have a controller attribute called [RequiresCompletedProfile], that I can put on action methods to disallow a user from going there unless they have completed their profile.
This was working fine when I had one kind of user, but the app has since evolved into having 2 kinds of users: Vendors and Clients.
So, there is no longer a "Use...
I know that we cannot set the Command Timeout in the Connection String. So I put it in the MyDataContext constructor. But there are many constructors, this file is usually overwritten by the visual designer and it doesn't seems the right way to do that. How would you do that?
...
After using .NET for several years, I've spent the last few months in the far off land of Ruby on Rails. While I can clearly see where much of Microsoft's MVC framework got it's influence, one of the things that I find myself suddenly missing when development in .NET are the Rails Model callbacks.
Specifically, you can add a callback t...
Hello,
I've been trying for a couple of days to write to "translate" this query in LINQ with no success so far. Could you guys please help me? I would also appreciate some explanation to learn actually something out of it.
Here is the T-SQL query:
SELECT R.ResourceID, R.DefaultValue
FROM Resources as R
JOIN
(SELECT [t0].[NameResou...
I'm building a core engine for my blog and would like to be able to extend it very easily.
At the moment my code looks like this:
[Table(Name = "dbo.ContentItem")]
[InheritanceMapping(Code = "MyNameSpace.Items.SysRoot", Type = typeof(SysRoot), IsDefault = true)]
[InheritanceMapping(Code = "MyNameSpace.Items.SysRecycleBin", Type = typeof...
I am writing this code. Here dt is input into the function, as well as someint. The column Exp is a T-SQL date column, which comes as a DateTime through Linq.
return (from a in dataContext.TableOfA
where a.name == "Test" &&
a.Exp.Value.AddDays(Convert.ToDouble(Someint)) >= new DateTimeOffset(dt)
select a).First();
...
Hi,
Struggling between choosing linq2sql and nhibernate.
Let me give you some insight in the application in point form:
this is a asp.net mvc application
it will have lots of tables, maybe 50-60 (sql server 2008)
i would want all the basic crud logic done for me (which I think nhiberate + repository pattern can give me)
i don't have ...