or-designer

How do you use Linq to connect tables in different databases?

I'm a bit of a Linq newbie, and I couldn't find any documentation to help me with what seems to be a pretty trivial problem - so your help will be much appreciated! I have a table Table1 in database DB1, which has a "pseudo" foreign key Table2ID to table Table2 in database DB2, on the same server. "Pseudo", because obviously I can't ha...

Using reflection to address a Linqed property

I'm trying to writing a generic method that will load a record of a specific type, with a specific ID. Here's one way that works: public abstract class LinqedTable<T> where T : LinqableTable { public static T Get(long ID) { DataContext context = LinqUtils.GetDataContext<T>(); var q = from obj in context.GetTable<T>() whe...

LinqToSQL and auditing changed fields

Here's another one of these LinqToSQL questions where I'm sure I must have missed the boat somewhere, because the behavior of the O/R Designer is very puzzling to me... I have a base class for my LinqToSQL tables, which I called LinqedTable. I've successfully used reflection to get hold of all the properties of the descendant classes a...

My O/R Designer keeps deleting the designer.cs file!

I have a weird problem that sometimes when I make a change to a Linq object using the O/R designer (usually by adding a field that I've added in the DB), when I save the project, the designer.cs file gets deleted! Fortunately I have my source control to fall back on; I undelete the file and back out the changes to the csproj file. But ...

How do you implicitly convert a string value to an enumeration using LinqToSql?

I asked a previous question about mapping an enumerated value on a table using LinqToSql and the answer was to use the O/R Designer to set the type to global::MyNamespace.TMyEnum. That works OK if your enumeration is based on an integer. But what if your enum is based on a string value? The most obvious application of this is: public...

How to relate Linq-To-Sql objects that are on different dbml diagrams?

I have two different dbml diagrams reflecting my Linq-To-SQL classes. (This is necessary, because they appear in different projects.) One of the objects in the one diagram needs an association with an object in the other diagram. How do I do it? ...

How to sort DBML objects alphabetically?

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...