dbml

Controlling DBML EntityRef creation in DBML with multiple foreign keys

Using Linq to SQL and the autogeneration capabilities of DBML, foreign key relationships create EntityRefs in the DBML designer file. For example : private int _USStateId; private EntityRef<USState> _USState; However, if I have the need for a table with numerous FK relationships to the same table, how can i control the autogenerated...

DBML customization vs regeneration

I'm having a database with a lot of foreign key relationships defined. When I simply drag any table involved in these FK connections into the DBML editor, so as to machine-generate the DBML file, these will all be represented as associations. From here I'm able to make any changes to these associations: I might want the parent end of th...

Grab result set and return value both from stored procedure in Linq to Sql

CREATE Procedure dbo.Ssample AS Select 1 as One , 2 as Two ,'3' as Three RETURN 2 --T-SQL way to execute declare @a int exec @a = dbo.Ssample select @a How can I retrieve the return value and the result set both in linq to sql. I would appreciate if anyone can give me the dbml markup as my designer file always get auto gener...

help with LINQ join

Hi - I'd like to get some help on how to formulate this query: I Have a snapshot of the datamodel relevant to this question at: http://jdsign.dk/media/9221/dbdiagram.png To the method that should be created the input is a guid userid in the following called inputuserid. Please help me get: a list of all the subjects that have any note...

In generating a Linq to SQL class, how can I define a complex relationship?

I have two views: one is a normal view built from one table with an integer ID and other columns for the record (let's call it View1). I have another View (View2), which has an integer ID column and a second column named "table" (type: varchar). That second column contains the name of the table to which the ID column is related: So, i...

design for table join in .dbml file

hello, I am creating project with MVC vs 2010. I want to use LINQ for queries. I have created a .dbml file and drag and drop tables on it. In some online tutorials there are scalar and navigation properties while dealing with table join in designer surface. How to get these properties, shown in designer surface in .dbml file. Can a...

sqlmetal error with given key was not present in the dictionary for tables with foriegn key defined

I am using sqlmetal on Ubuntu Linux and want to generate the dbml for a sqlite database that has just 2 tables created as follows: CREATE TABLE "user" ( "uid" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" TEXT NOT NULL ); CREATE TABLE "bridge" ( "pkey" INTEGER NOT NULL, "rkey" INTEGER NOT NULL, "location" TEXT, PRIMARY KEY (pkey...

Added a table to a dbml, but it doesn't show up in code

I am using VS2010 with C#, and linq-to-sql. Does anyone have any ideas of where to start looking for a solution? My database has a 'Cats' table and there is a 'Feet' and 'EyeColour' table that are both linked to it with a one-to-one relationship. The 'Feet' table works fine with linq-to-sql, but 'EyeColour' does not. I dragged the Eye...

Using Linq to SQL and dbml to create _and_ upgrade database?

Im using dbml (c# vs2010) to model my database and DataContext.CreateDatabase() to create it. Some time later I add a new property to one entity-type and now I want to upgrade the SQL-database to fit the new version of the dbml-schema. How do I accomplish this? Do I have to delete and re-create the database or upgrade it manually? Is ADO...

LINQ Doesn't create DBML file correctly when updating a stored procedure

It instead creates it with a return value of int and doesn't create the spGetRowsFromTableRESULT object, which causes major problems in my application. Previous solutions in the past have been to remove the stored procedure from the DBML file, re-compile (commenting-out any references) and re-adding it. Please if anyone has any informa...

How to update data model class after manually changing .dbml file

Hello. Does anyone know how could I get the data model class updated after I make some custom changes in the .dbml file. I tried to manually mark some fields nullable in the .dbml, but changes are not visible in the code, no matter how many times I rebuild. I even tried to edit .dbml(xml) in an external tool, and then save, but no use....

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