Questions tagged [sqlmetal]

The SqlMetal command-line tool generates code and mapping for the LINQ to SQL component of the .NET Framework.

The SqlMetal command-line tool generates code and mapping for the LINQ to SQL component of the .NET Framework.

93 questions
3
votes
2 answers

LINQ to SQL - Sql tuning

I am using LINQ to SQL for much of the data access layer and am trying to view and tune the underlying SQL used. Does anyone know a good mechanism to intercept the SQL used by C# LINQ and/or replace it with a more tuned query?
lap
  • 308
  • 2
  • 7
3
votes
0 answers

SqlMetal is ignoring one association

I'm using SqlMetal to generate a map of the DB in C# against the developing environment DB. The generated file has 1,89MB. SqlMetal /server: /database: /user: /password: /code:DBO.cs /namespace: In order to have…
dcarneiro
  • 7,060
  • 11
  • 51
  • 74
3
votes
2 answers

how do you generate class for LINQ to SQL?

I am using linq to sql for my mvc 3 project. There are several ways to generate domain modal class files. sqlmetal Object Relational Designer hand code I always hand code those model class files. because files generated by sqlmetal or designer…
qinking126
  • 11,385
  • 25
  • 74
  • 124
3
votes
1 answer

Generating your LINQ-to-SQL datalayer

I usually use Codesmith & NetTiers for my datalayers, and as they can be run from the command line it just requires a simple batch file to regenerate / rebuild everything whenever changes are made to the database. Now I'm looking at LINQ-to-SQL, but…
Nick
  • 5,616
  • 10
  • 52
  • 72
3
votes
2 answers

System.DateTime and Sql datetime2 in Linq2Sql (using sqlmetal)

I'd like to utilize new Sql datetime2 data type for event logging (as standard datetime has lower precision than System.DateTime causing data loss on storing) but when i generate the code with sqlmetal.exe i get the following warning: db.dbml(98) :…
UserControl
  • 14,766
  • 20
  • 100
  • 187
3
votes
3 answers

SQL Server CE 4.0 w/ SQLmetal

I've created a small test project in WebMatrix which uses SQL Server CE 4.0. Not being a fan of using embedded SQL, I wanted to create some LINQ2SQL domain classes for the SQL Server CE 4.0 database generated by WebMatrix. Unfortunately SQLmetal…
Bent Rasmussen
  • 5,538
  • 9
  • 44
  • 63
3
votes
1 answer

Generate linq classes using sqlmetal for npgsql

I am trying to generate c# classes for Linq (or Entity Framework 6) from an existing PostgreSql database on a Linux . I installed npgsql and Entity Framework 6 in a monodevelop project and I was able to query the database with pure SQL. But when I…
Amine Kerkeni
  • 914
  • 3
  • 14
  • 29
3
votes
2 answers

SQLMetal DataContext Associations Not Generated

I am generating the LINQ-to-SQL DataContext and entity classes for a database. The database has several tables, two of which are - [AccountMaster] and [AccountCodes]. There is a foreign key relationship defined between them, with…
Alex
  • 3,644
  • 2
  • 19
  • 27
3
votes
1 answer

SqlMetal Not Generating Views, Functions, or Stored Procedures

I am using the following commands as part of a cmd file: sqlmetal /server:localhost\SQLEXPRESS /database:DashBoard /dbml:DataClasses.dbml /namespace:DashBoard.Data sqlmetal /server:localhost\SQLEXPRESS /database:DashBoard /views /functions /sprocs…
Aaron
  • 2,427
  • 4
  • 30
  • 41
3
votes
1 answer

Why is SQLMetal.exe generating different results for SQL Compact 3.5 and SQL Express 2008 (foreign keys are missing)

Here's the story: I created a SQL Compact 3.5 database and used SQLMetal.exe to generate DataContext for it. It worked well, but soon I realized that it simply does not suit my needs so I decided to go for SQL Express 2008. I fired up the very same…
gavoja
  • 369
  • 1
  • 4
2
votes
1 answer

Generating Linq classes from a SQL Compact 3.5 database using SQLMetal

I am generating Linq classes by running SQLMetal from the command line against a Compact 3.5 database. The Compact 3.5 database is a local database cache (generated by the Sync Framework "Create Local Database Cache wizard). CE seems to support…
cdonner
  • 37,019
  • 22
  • 105
  • 153
2
votes
2 answers

selective get and delete posts from database

In my windows phone 7 app i have database-class generated by sqlmetal. in addition, i have class that helps to work with this database. public static IList GetTasks() { IList tasks = new List(); using (var…
Alexander V.
  • 1,573
  • 3
  • 10
  • 12
2
votes
4 answers

How to create a LINQ To SQL datacontext for large DB using SQLMetal when it generates a 12MB DataContext.cs file?

My problem is this: We have a very large Legacy DB with many SPROCs, Views & Tables. The Designer is a "NO GO" b/c of the size. I've configured SQL Metal to build the data context, but the resulting code file is so big (12MB) visual studio 2008…
Sumtraveller
  • 1,186
  • 2
  • 9
  • 13
2
votes
2 answers

SqlMetal generating garbage association names

Why is SqlMetal messing up the Association names. For e.g. in my 'TextMessage' table i have two columns referencing the 'ApplicationUser' table. 'SenderUserId' and 'RecipientUserId' When I run SqlMetal and look at my 'ApplicationUser' class For…
Ali Kazmi
  • 3,610
  • 6
  • 35
  • 51
2
votes
1 answer

WCF attributes and linq to sql

How can I generate dbml file (with Sqlmetal.exe) with appropiate WCF attributes (DataMember, DataContract etc)? for example: I have Client table with columns: ClientID, Name, IP, City, Phone I'd like make Client class generated in dbml as…
Saint
  • 5,397
  • 22
  • 63
  • 107