sqlmetal

SqlMetal wrongly generates the return type of my stored proc (LINQ)

痴心易碎 提交于 2020-01-13 09:58:07
问题 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 remove the if (putting a single SELECT call), an ISingleResult return type is generated. Any ideas? 回答1: The scenario you're describing is by design. I've tested with both

Use SQLMetal on SQL Azure Database

℡╲_俬逩灬. 提交于 2020-01-05 09:07:46
问题 For reasons that I would not like to discuss, our master database schema is currently only in SQL Azure. We are working on bringing it down locally using a tool like Enzo Backup (we're waiting on their developers to fix some bugs we got when attempting to download), but in the meantime, I would like to generate a Linq-to-Sql ORM mapping from the SQL Azure DB schema. When I attempt to do this, the output generates a bunch of error messages like this: Warning : SQM1012: Unable to extract table

SQLMetal DataContext Associations Not Generated

微笑、不失礼 提交于 2019-12-23 17:43:53
问题 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 dragging these tables onto the DBML design view appropriately generates a collection of AccountNotes within the AccountMaster class. Meanwhile, using SQLMetal

can anyone think of why using this particular class in a design time data source will break all design time bindings?

微笑、不失礼 提交于 2019-12-11 19:23:23
问题 I generated this class using SQLMetal.exe. It is very bindable at runtime, but if I use this class at design time, all of my design time blend bindings are busted. I am using the MVVM-Light framework and I am building an app for WP7. If I extract an interface for this class, and create a simple POCO that implements this interface and I use my simple poco in my design time data source, all of the bindings come alive. Here is the class that was generated by SQLMetal.exe. [Table(Name=

WCF attributes and linq to sql

心已入冬 提交于 2019-12-11 00:11:00
问题 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 [DataContract] and Name and IP as [DataMember] ? 回答1: i think this post in msdn blogEnabling .dbml file for WCF can be usefull 来源: https://stackoverflow.com/questions/7970206/wcf-attributes-and-linq-to-sql

SQL Metal for specific tables or another way to refresh/add table to .dbml file

心已入冬 提交于 2019-12-06 05:57:48
问题 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? 回答1: SqlMetal Include worked like a charm for me. First Create a complete dbml file using SqlMeta - Say testComplete.dbml Now provide this file as an input to SqlMetaInclude SqlMetalInclude /dbml:"testComplete.dbml" /output:"testSubSet.dbml" /include:dbo

Multiple foreign keys to the same table

元气小坏坏 提交于 2019-12-03 09:51:48
问题 I have a reference table with all sorts of controlled value lookup data for gender, address type, contact type, etc. Many tables have multiple foreign keys to this reference table I also have many-to-many association tables that have two foreign keys to the same table. Unfortunately, when these tables are pulled into a Linq model and the DBML is generated, SQLMetal does not look at the names of the foreign key columns, or the names of the constraints, but only at the target table. So I end up

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?

穿精又带淫゛_ 提交于 2019-12-01 09:07:22
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 success, but even with that it's fairly unclear. I know there is at least one commercial tool out there that claims to address this problem, but I am looking for something free. How are people dealing with this issue? +1 on the question. But what's bad about using a

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?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 06:50:59
问题 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 success, but even with that it's fairly unclear. I know there is at least one commercial tool out there that claims to address this problem, but I am looking for

SQLMetal Multiple Foreign Keys Pointing to One Table Issue

孤街浪徒 提交于 2019-11-28 03:54:29
问题 Edit - Cleaning up question to better reflect the actual issue: I'm using SQLMetal to generate database classes from our SQL Server db. Recently, I needed to add a table that had multiple foreign keys pointing to the same table. Using LINQPad to play around with the new tables, I was able to access properties for both foreign keys like so: record.FK_AId record.FK_BId record.FKA record.FKB ...which is just how I would expect it. The problem is, the classes generated by SQLMetal produce these