Generate POCO classes in different project to the project with Entity Framework model

Actually the T4 templates in EF 4.0 were designed with this scenario in mind 🙂 There are 2 templates: One for the Entities themselves (i.e. ModelName.tt) One for the ObjectContext (i.e. ModelName.Context.tt) You should put the ModelName.tt file in you POCO project, and just change the template to point to the EDMX file in the … Read more

Generate Delete Statement From Foreign Key Relationships in SQL 2008?

Here is a script for cascading delete by Aasim Abdullah, works for me on MS SQL Server 2008: IF OBJECT_ID(‘dbo.udfGetFullQualName’) IS NOT NULL DROP FUNCTION dbo.udfGetFullQualName; GO CREATE FUNCTION dbo.udfGetFullQualName (@ObjectId INT) RETURNS VARCHAR (300) AS BEGIN DECLARE @schema_id AS BIGINT; SELECT @schema_id = schema_id FROM sys.tables WHERE object_id = @ObjectId; RETURN ‘[‘ + SCHEMA_NAME(@schema_id) … Read more

zip(list1, list2) in Jinja2?

Modify the jinja2.Environment global namespace itself if you see fit. import jinja2 env = jinja2.Environment() env.globals.update(zip=zip) # use env to load template(s) This may be helpful in separating view (template) logic from application logic, but it enables the reverse as well. #separationofconcerns

How do I generate a constructor from class fields using Visual Studio (and/or ReSharper)?

In Visual Studio 2015 Update3 I have this feature. Just by highlighting properties and then press Ctrl + . and then press Generate Constructor. For example, if you’ve highlighted two properties it will suggest you to create a constructor with two parameters and if you’ve selected three it will suggest one with three parameters and so on. … Read more

What is the correct way to write HTML using Javascript?

document.write() will only work while the page is being originally parsed and the DOM is being created. Once the browser gets to the closing </body> tag and the DOM is ready, you can’t use document.write() anymore. I wouldn’t say using document.write() is correct or incorrect, it just depends on your situation. In some cases you … Read more

techhipbettruvabetnorabahisbahis forumu