I work on a web game , I use asp.net mvc, linqtosql.
I have 3 tables that store default game values: DefaultRegions, DefaultSubRegions and DefaultCountries. These 3 tables are related to each other thanks to primary / foreign keys.
I need to copy the values of these tables into 3 tables called Regions, SubRegions and Countries when som...
How do you insert/update a column through Linq To SQL and Linq To SQL use the default values? In particular I'm concerned with a timestamp field.
I've tried setting that column to readonly and autogenerated, so it stopped trying to put in DateTime.MinValue, but it doesn't seem to be updating on updates.
...
Is it quicker to make one trip to the database and bring back 3000+ plus rows, then manipulate them in .net & LINQ or quicker to make 6 calls bringing back a couple of 100 rows at a time?
...
i am just trying to generate the classes for linq to mysql with dbmetal / visual metal and keep running into the error: "magma string must not be empty"... i've googled, i've recompiled locally, checked the references etc. and don't really want to start debugging this... anybody had the same issue before or knows of another way to genera...
Hi all,
I saw a code snippet yesterday in one of the responses here on StackOverflow that intrigued me. It was something like this:
List<string> myList = new List<string> {"aBc", "HELLO", "GoodBye"};
myList.ForEach(d=>d.ToLower());
I was hoping I could use it to convert all items in myList to lowercase. However, it doesn't happen...
I have an IQueryable and an object of type T.
I want to do IQueryable().Where(o => o.GetProperty(fieldName) == objectOfTypeT.GetProperty(fieldName))
so ...
public IQueryable<T> DoWork<T>(string fieldName)
where T : EntityObject
{
...
T objectOfTypeT = ...;
....
return SomeIQueryable<T>().Where(o => o.GetProperty(fi...
Are there any Platform agnostic (not CLI) movements to get LINQ going for C++ in some fashion?
I mean a great part of server frameworks around the world run on flavors of UNIX and having access to LINQ for C++ on UNIX would probably make lots of people happy!
...
Can anyone suggest good article on services over linq to sql ?
...
I'm trying to figure the best strategy about how to organize DataContexts. The typical DB we work has between 50 and 100 tables usually in third-normal form and with many relations between them. I think we have two options:
Put all tables in a single context. This will ensure that anything we do will be committed in the correct order i...
Whenever I drop a new database object from server explorer into the dbml, Visual Studio replaces the connection string in the designer file with a new one that it automatically adds to the connection strings in my config file. They both have exactly the same parameters, just different names.
How do I force Visual Studio to use and keep ...
I just downloaded MVC and I am going through a tutorial. Everything goes fine until I try to declare a DataContext object.
My dbml is named db.dbml (tried another on named test.dbml) and when I try this:
public dbDataContext db = new dbDataContext();
I get:
The type or namespace name
'dbDataContext' could not be found ...
Am...
I have an IList of type Breadcrumb which is just a lightweight class that has NavigationTitle, NavigationUrl and IsCurrent properties. It is cached on the webserver. I have a method that builds out the current breadcrumb trail up until the first Breadcrumb that has IsCurrent set to true... using the code below. Its very ugly and definite...
I remember reading a post about a year or so ago by Scott Hanselman (maybe by scott guthrie) about how Linq evolved. It remember it showing that anyonymous types led to lambda expressions which then led to Linq in some way. I can't seem to find it on google. Does anyone else remember this post? If so, can you please post it?
...
I'm trying to perform a simple LINQ query on the Columns property of a DataTable:
from c in myDataTable.Columns.AsQueryable()
select c.ColumnName
However, what I get is this:
Could not find an implementation of the query pattern for source type 'System.Linq.IQueryable'. 'Select' not found. Consider explicitly specifying the t...
Is there a better way to do this?
string[] s = {"zero", "one", "two", "three", "four", "five"};
var x =
s
.Select((a,i) => new {Value = a, Index = i})
.Where(b => b.Value.StartsWith("t"))
.Select(c => c.Index);
i.e. I'm looking for a more efficient or more elegant way to get the positions of the items matching the criteria.
...
I'm attempting to use LINQ to insert a record into a child table and I'm
receiving a "Specified cast is not valid" error that has something to do w/
the keys involved. The stack trace is:
Message: Specified cast is not valid.
Type: System.InvalidCastException
Source: System.Data.Linq TargetSite:
Boolean
TryCreateKeyFrom...
Hi all,
I am trying to get the signature on the method below to work. As this is an Anonymous Type I have some trouble, any help would be great.
When I looked at sortedGameList.ToList() in a QuickWatch window I get the signature
"System.Collections.Generic.List<<>f__AnonymousType0>>"
Many Thanks
Donald
public List<IGrouping<Dat...
I have a C# collection of strings. Each string is a sentence that can appear on a page. I also have a collection of page breaks which is a collection of int's. representing the index where the collection of strings are split to a new page.
Example: Each 10 items in the string collection is a page so the collection of page breaks would b...
edit #2: Question solved halfways. Look below
As a follow-up question, does anyone know of a non-intrusive way to solve what i'm trying to do below (namely, linking objects to each other without triggering infinite loops)?
I try to create a asp.net-mvc web application, and get a StackOverFlowException. A controller triggers the follo...
Is it possible to load child entities in a single query without using DataLoadOptions?
I am using one data context per request in an asp.net web application and trying to get around the linq to sql limitation of not being able to change dataloadoptions once a query has been executed.
Thanks.
...