For questions specifically about the linq-to-sql dbml file (structure or location) generated by SqlMetal or Visual Studio. Questions about linq-to-sql should be tagged by the [linq-to-sql] tag.
Questions tagged [dbml]
82 questions
1
vote
1 answer
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…

BlueMonkMN
- 25,079
- 9
- 80
- 146
0
votes
1 answer
DynamicData: use custom type as return type
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…

balint
- 3,391
- 7
- 41
- 50
0
votes
0 answers
Generating designer.cs code class for a DBML file using Pre build event in Visual Studio 2022
Question:
I have a DBML file located within a Data\Linq folder in my Visual Studio 2022 project. I'm aiming to automatically generate the designer.cs code class for this DBML file using the Pre build event feature.
Could someone provide step-by-step…

Muhammedh
- 484
- 1
- 11
- 25
0
votes
0 answers
How to specify a default value for a column in a .Net Linq Transactional.dbml file?
Is it possible to set a default value using the DbType property or some other method? I found this answer but not sure if it's what I'm looking for given the comment underneath.

Rokit
- 977
- 13
- 23
0
votes
0 answers
.dbml (Data class) in different namespace and file
I am new to LINQ to SQL and need some help on separating out data classes vs CRUD operation performed on database. I need to separate out Data Classes from .dbml designer file and move it to another namespace and preferably in new file.
Default…
0
votes
0 answers
Large DBML (Linq-to-SQL) gets corrupted when edited
I have a large DBML and when I edit something, it gets corrupted.
I digged a into the problem and found that when I save the edited DBML file, it creates a new designer file, with a 1 added to the end of the name. The original designer file and the…

JPScerri
- 115
- 1
- 1
- 8
0
votes
1 answer
Return the same type for two views from datacontext
I have created two views that return exactly the same columns from the same tables. The only difference between the two views is they filter on different parameters. I have added these into my .dbml file
(Picture of views in dbml) This has then auto…

Sam
- 1
0
votes
0 answers
Introducing POCO classes to existing solution
My projects structure is as follows
DAL - Class Library
- EDMX File (but i dont want to depend on Entity Framework either so it could be a Linq to SQL file)
BusinessLogic - Class Library
- ICustomer (Interface Class, Add, update, edit…

Computer
- 2,149
- 7
- 34
- 71
0
votes
2 answers
linq2sql C#: How to query from a table with changing schema name
I have a webservice which tries to connect to a database of a desktop accounting application.
It have tables with same name but with different schema names such…

VSB
- 9,825
- 16
- 72
- 145
0
votes
0 answers
When I run msxsl.exe on my DBML file, it introduces carriage returns that mess up the final SQLMetal.exe step
I just upgraded from VS 2015 to VS 2019 (and Windows 7 to Windows 10). My project is using SQLMetal.exe and msxsl.exe in a batch file to create and modify the DBML in three steps:
Generate the DataModel.dbml file with SQLMetal.exe.
Add database…

John Pasquet
- 1,824
- 15
- 20
0
votes
1 answer
How to get Visual Studio O/R Designer to auto generate collection of inherited objects?
I have a project for which I am making use of the O/R designer in visual studio.
I would like to log history against multiple record types using the same basic table.
To do this, I have a "History" table which takes an int named "Type" and an int…

James
- 1
0
votes
0 answers
LINQ to SQL - VISUAL STUDIO Community 2017
How can i add LINQ to SQL class (.dbml file) to a Visual Studio 2017 Project. I can't find it. even though i added the " Linq to SQL tool " it in the " Visual Studio Installer " i couldn't find it. Any solutions please ?

Walid Ouhammi
- 1
- 2
0
votes
0 answers
Why does the same code renders different results between debug and release builds
EDIT:
The if statement that determines whether to continue processing leads is not wrapped in an #if DEBUG...#else directive so it should execute in all cases.
TL;DR Some part of my code is returning different results when I run in debug to what it…

Ortund
- 8,095
- 18
- 71
- 139
0
votes
1 answer
Why does my DBML send varchar(8000) to my database on InsertOnSbumit?
I have a pretty straight forward table in my dbml with a few varchar(20) and 2 varchar(50) columns:
Here is the xml definition of my dbml:

ElMatador
- 557
- 1
- 6
- 15
0
votes
1 answer
Add a table in .dbml file in Visual Studio 2017
Adding a table in the .dbml file by drag and drop in Visual Studio 2017 community edition generates this error.
Failed to retrieve data for this request.
Failed to connect to server 10.1.2.3.
Login failed for user 'user'.
I am able to log in and…

FLash
- 696
- 9
- 27