Im planning to write a code generator to generate UI (forms, grids, etc.). Since i'm using Linq i'm planning to read dbml file for metadata extraction purposes. I wonder if there is some Api to read the Dbml object model (database, tables, columns, asociations).
I've opened SQLMetal.exe with Red Gate's .NET Reflector, it contains a nam...
Is there any possibility to set OneToOne relation (cardinality) when generate dbml with SQLMetal? By default dbml schema generated with the OneToMany relation.
...
I was looking to create a pre-build method for a web application using SQLMetal to bring any changes since the last build into my DBML file. Since we are just starting out with LINQ most of the large database is not in the DBML. Is there any way to use SQLMetal to just regenerate a handful (less than 10) of tables and about 3 SPROCs or...
I'm thinking of using SqlMetal to auto-generate LinqToSql code for a simple and small database. The database will have only tables with some primary and foreign keys (i.e., no views, stored procedures, functions, etc.). I'd like to do all joins, grouping, sorting, and advanced data manipulation using Linq.
I have experience with LinqToO...
When dbml file is generated automatically by Visual Studio I get the exact field names as they appeared in the tables.
However, since VS does not provide refresh function for dbml, I run sqlmetal manually to re-create dbml file. It works fine with one exception -- sqlmetal "corrects" the names
ses_Id -> Ses_Id
aga_Id -> Aga_Id
and so...
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 /code:DataClasses.designer.cs /context:DataClassesDataContext /namespace:DashBoard.Data Da...
Sqlmetal creates "embedded" properties for any foreign key it finds for table. Nice. The problem is when I have several foreign keys which refers to the same (foreign) table.
This I like:
FK_Company_Post
then I can write in code:
company.Post
But this I don't like -- cutting suffixes:
FK_Company_Post_HQ
FK_Company_Post_Mailing
...
Hi,
Hi have a stored proc that always returns a single row depending of a parameter:
IF @bleh = 1
SELECT TOP 1 Xyz FROM Abc
ELSE
SELECT TOP 1 Def FROM Abc
I must use SqlMetal to generate the DataContext but this stored procedure returns a IMultipleResults, which is an error. Instead it should return a ISingleResult...
If I remov...
I have this 2 tables
table name: Person with Columns:PersonID, Name
table name: VisitInfo with Columns: VisitPersonID , CoordinatorPersonID
both columns have a foreign key to person table
When i generate the code i get a VisitInfo class with the properties:
Person
CoordinatorPerson
But what i want is a VisitInfoClass with the ...
Hi All,
How do we mention the Table information in the command when we want to generate the external mapping file directly from the database. We have the /Database option but how do we mention the table information
...
I have 2 databases with a 2 tables with HierachyID fields.
For one database I can get a dal cs file, for the other database I cannot get a dal cs file ?
HBus is a database I can get the dal cs for, ...
SqlMetal /server:.\SQLSERVER2008 /database:HBus /code:HBusDC.cs /views /functions /sprocs /namespace:HBusDC /context:HBusDataContext
...
I'd like to save the creation time of a row, so I have created a datetime column and set it's Default Value to be Getdate(). But when I generate the dbml file from SQLMetal and re-create the database from it, the function is missing.
I've added the /functions parameter to the command line when running SQLMetal but this didn't fix the pr...
I want to be able to interact with an SQL database using LINQ and Excel (it's a legacy thing). Is this sort of thing possible?
I'm screwing around with SQLMetal, and have generated some database classes in VB, but they don't seem to go in smoothly into Excel (I'm getting a lot of red error text).
Any ideas would be appreciated.
...
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 [AccountMaster].AccountNumber being referenced from [AccountCodes].
Adding a LINQ-to-SQL file in VS2008 and ...
I'm using LinqToSQL in a 3.5 framework project in VS2K8, running against MS SQL 2k8.
When I create the table mappings using the design surface within Visual Studio everything works fine.
When I create the table mappings using SQLMetal (from the Windows SDK v6.1), SQLMetal complains about about the SQL Server 2k8 datatypes (e.g. date an...
We have a SQL Server 2008 database that has recently been updated to use the geography (spatial) type. We use SQLMetal to generate our DAL (LINQ entities) and since the type upgrade, this now fails to produce a .cs file due to a missing type error which causes SQLMetal to abandon the process.
Is there a workaround (other the removing th...
Hi,
anybody have any easy way of doing this in Visual Studio, without having to use the Server Explorer ?
I tried also looking at macro's but recording only produce
Sub TemporaryMacro()
End Sub
So no luck there.
Any way to script this?
...
Hello all,
I'm having trouble figuring out the best approach for an certain application. I'm not really used to newer architectures that superseded old TLA (three layer architecture), so that's where I'm coming from.
When designing the Model and the DAL for my application (POCO classes, right??), I got the following doubts:
Should my...
I'm using sqlmetal.exe to generate a DataContext class from a sqlserver database to use with LINQ. I have a bunch of stored procedures that in some cases returns a primary key column that is a NOT NULL INT, such as this one:
CREATE PROCEDURE spDDIs_Find(@DDINumber VARCHAR(64)) AS
IF NOT EXISTS (SELECT ID FROM tDDIs WHERE DDINumber = @D...
I ran into an issue trying to update a foreign key field:
record.ForeignId = newId;
It bombs with "Operation is not valid due to the current state of the object" due to SQLMetal code that throws System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException().
I was not the first to hit this issue:
http://stackoverflow.com/questions/2...