dbml

How to swallow … exception with specific reason

帅比萌擦擦* 提交于 2021-01-28 04:13:07
问题 In this method public static void Detach() { try { using (var master = new DataContext(@"Data Source=(LocalDB)\MSSQLLocalDB;Initial Catalog=master;Integrated Security=True")) { master.ExecuteCommand(string.Format("ALTER DATABASE [{0}] SET OFFLINE WITH ROLLBACK IMMEDIATE", DatabaseFile)); master.ExecuteCommand(string.Format("exec sp_detach_db '{0}'", DatabaseFile)); } } catch (Exception e) { ... // add to log } } I can receive exception System.Data.SqlClient.SqlException (0x80131904): The

Visual Studio 2013. dbml file not updating

元气小坏坏 提交于 2020-01-07 04:28:29
问题 I am working on a Visual Studio project that uses ASP.NET/C# with LinqToSql. All has been going fine, until some changes were made to one of the database tables. After that, the Table in question was removed from the DBML database diagram, and the new version added back in using the Server Explorer. Trouble is, VS2013 still does not see the new fields, and will not compile if I reference them. The new table structure is clearly visible in the DBML database diagram. 回答1: Rebuild your project

Refreshing LinQ2SQL Model in Designer without losing all Properties

坚强是说给别人听的谎言 提交于 2019-12-11 07:46:38
问题 so I'm using LinQ2SQL quite heavily in my current application, and although I have most stuff in partial classes, some things have to be adjusted in the VS Designer (like Accessors for fields I wrap). Then, sometimes I like to name Fields differently in the Model than they do in the DB. So, my problem now is. When going back to changing a already known table I have only two options: Introduce new fields through the designer manually Delete the Table from the Model and newly import it from