dbml

LINQ to SQL and get Association values from dbml file

I have a dbml file that was autogenerated. I want to, in code (VB.Net) get the Association values for one of the properties. How is this accomplished? Basically, in my vb.Net code I'd like to somehow know (in the following example) the LookupDocumentStatus.IsForeignKey and the LookupDocumentStatus.ThisKey value. Is there an easy way to...

Multiple DBML files - type sharing?

Hi, I have a Client/Server application, where the Client and Server have some common tables (which are kept in synchronisation as part of the application). We currently store these tables (i.e. FileDetails) in a Shared.dbml file. Until now, any stored proc that returns a result of set of FileDetails, has been placed in the Shared.dbml ...

LINQ to SQL -- Can't modify return type of stored procedure.

When I drag a particular stored procedure into the VS 2008 dbml designer, it shows up with Return Type set to "none", and it's read only so I can't change it. The designer code shows it as returning an int, and if I change that manually, it just gets undone on the next build. But with another (nearly identical) stored procedure, I can...

When I make a database change, how do I know what needs to be removed and readded to the LinqToSql O/R Designer in Visual Studio?

For example, I alter a column in a table to be not null from null. I need to then delete and readd the table. That part is pretty clear. What about views, functions, and stored procedures that access the table, especially that column in the table? I've tried running diffs against the files generated by SQLMetal with some limited succ...

DynamicData: use custom type as return type

Hi, can I force the DBML designer to use my custom types instead of the Auto-generated Types? I can edit the database.designer.cs, but these changes will be lost when I modify the tables. If not, how can I easily "convert" from the auto-generated type to my custom type in Linq? ...

C# DBMLs and SQL Server

Hello, My dev machine has SQL Server 2005 on it and that is how I make my DBML file and define the tables in there and then make a WCF Service. When i go to host the WCF service, the server has SQL Server 2000, it finds the connection string fine but not the table im pointing it to. Is there a way to tell through the web.config file whic...

IMultipleResults LINQ DBML Classes Not Resolving

In my partial class which defines a function which returns the type of IMultipleResults to bring back multiple result shapes from a stored procedure using the classes defined in my *.dbml file, for some reason the [ResultType(typeof(MyType))] isn't working. The MyType is saying that it cannot be found. The function is in the .cs file o...

Inheritance of LINQ to SQL data context

If I inherit one DBML file from another DBML file, is it possible to visually create associations to the data classes from inherited DBML? ...

dbml entity relationship problems

I'm creating a .dbml file from a database. My "property" table has foreign keys to the "county" table and to a "propertysource" table. When code is generated, Property.Source is defined as a PropertySource type, but Property.County is defined as an int, instead of a County type. I'm afraid I don't have the experience with LINQ to SQL t...

How to update Linq to SQL dbml file? [best practice]

How to do it? ...

LinqToSql dbml dynamically switch connectionstring

Greetings All, We have two databases, DEV and STAGING. They are for the most part identical. I have an app settings tag in the Web.Config call it "mode", and two connectionstring entries. If mode=DEV I want to use ConnectionString 1 otherwise use ConnectionString 2. This works fine in some parts of the app, but the dbml doesn't seem to ...

LinqToSQL - mapping out the DataContext with lots of tables?

I've been working on a project where I have been using LinqToSQL that involved a lot of tables. All of these where mapped in one .dbml file (i.e. only one DataContext). I did this on the pretense that (currently) you cant join across multiple data contexts. For example... DB1DataContext db1 = new DB1DataContext(); DB2DataContext db2 = n...

Looking for a class in large dbml files

Hi does someone know a quick way to find a class in large dbml files. We have a large data model and it takes a good 2-3 minutes to scroll and locate the required class. Zooming out makes it quite hard to see. There has to be a better way than manually looking around ...

Linq to Sql Data class in dbml

I am abit curious about dbml.... Should I create one dbml file for one database or separated into different parts e.g. User dbml (only tables relate to users) etc? When I do this I will have abit of problems. Assume the User dbml has a User table and if the Order dbml has a User table as well, this won't be allowed if the entity namespac...

MSLinqToSQLGenerator generates different output than SQLMetal

I have a rather large DBML file and recently discovered that Visual Studio's MSLinqToSQLGenerator is generating different output than: SqlMetal.exe All.dbml /code:All.designer.vb /namespace:LINQ2FSE /pluralize /provider:SQL2005 It seems to have dropped an arbitrary (and I think relatively small) set of associations from the generated ...

Why are my manually created Linq2Sql table relationships showing up in code?

I have some views that I'd like to relate together in my Linq2Sql DBML file. I've right clicked, selected "Add association" and manually created the associations from children to parents, for example: Customer.TypeId -> CustomerTypes.Id But I cannot do this in my code: from c in Customers select c.Type.Name Any clues? If the relat...

Problems serializing DBML objects C#

I am trying to serialize some Linq objects using this code. private byte[] GetSerializedObj(object o) { try { DataContractSerializer formatter = new DataContractSerializer(o.GetType()); MemoryStream memStream = new MemoryStream(); formatter.WriteObject(memStream, o); return memStream.ToArray(); ...

Tables from two different databases in a DBML?

After dragging two tables in from one database, I switch to another and drag a table in. Now I get a message if I want to replace the connection string with the new one. I want tables from multiple databases in one DBML. Is this possible? ...

Override LinqToSql class property

One of the fields in a table in my database stores string values delimited by '|'. Of course, when I generated a Linq data model from the table using the VS designer, a string property has been created for the mentioned field. I want to override that property so as to expose the stored values as a more convenient string array (splitting ...

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