Posts

Entityframework reverse POCO generator V2.1 released

Whats new in v2.1.0: Fixed bug if default constraint was not in expected format. Thanks to Filipe Fujiy . Now detects name clashes with C# keywords. Added "System." to DateTime.Now(), etc to prevent clashes with table field names. "Configuration" class names are now configurable as "Mapping", "Map", etc. Added support for Spatial.DbGeometry and Spatial.DbGeography. Thanks to  Simply Foolish and Jorge Bustos . Can now have custom collection type for Navigation Properties. "ObservableCollection" for example. Thanks to  Simply Foolish . Watch the video and Download at  visualstudiogallery

NServiceBus and encrypting strings in messages, plus how to remove NServiceBus from your messages library

Summary There are a few blog posts about using NServiceBus and encrypting strings using the WireEncryptedString type. However, you can also mark an ordinary string to be encrypted via configuration, which is more desirable as you can remove the dependancy from NServiceBus from your common Messages library. There is a gotcha though, if you ever mix the two, then WireEncryptedString go back to being unencrypted in MSMQ. This blog post explains how to easily fix this, and also how to remove NServiceBus from your Messages library. Win Win. Source code is avilable here . Compiling the project will automatically download packages via NuGet. Initial project setup Always have a separate Messages project to keep your messages in. In this example, the project is called Messages and contains the following class: using   NServiceBus ; namespace   Messages {      public   class   MyMessage  :  IMessage     { ...

What's new roundup for EntityFramework Reverse POCO Code First Generator

Whats in the next version: Fixed bug if default constraint was not in expected format. Thanks to Filipe Fujiy . Whats new in v2.0: Fixed issue when running 'Transform All T4 Templates' from Visual Studio Build Menu. Thanks to JRoselle . Changing mappings during runtime is not possible/expensive. A specific DbModelBuilder can be used for each needed database schema. Thanks to meixger . Added ability to detect and use .IsRowVersion(). Added many-to-many mappings. The generated code now includes calls to .Map(). Therefore the generated code will be different to what you had previously in v1 if you have many-to-many table mappings in your database. Hence the revision change to v2.0.0 as I'm using semantic versioning . Whats new in v1.12: VARBINARY(MAX) is now correctly assigned to byte[]. Thanks to Luke91577 . Extending partial class support. Allow specification of file extension for partial classes (i.e. ".generated.cs"). Thanks to AB_dreeve . ...

EntityFramework Reverse POCO Code First Generator v1.4.1 released

Reverse engineers an existing database and generates EntityFramework Code First POCO classes, Configuration mappings and DbContext. v1.4.1 includes these new features: If a field has a default contrainst of GetDate(), add DateTime.Now() in the ctor for the field. Add support for the datetimeoffset type, including support for the default constraint sysdatetimeoffset(). Add Resharper naming comments. Mapping classes are marked internal. Make sure Foreign keys map only to Primary keys. To see a video, head over to http://visualstudiogallery.msdn.microsoft.com/ee4fcff9-0c4c-4179-afd9-7a2fb90f5838

“Entity Framework Reverse POCO” OSS project made top link today (Dec 7)

Image
I saw a spike on the Entity Framework open-source project I created, and had a look around to see what it could be…   Found it listed as the top link on http://www.alvinashcraft.com As developers we take so much (understatement) from the open-source community ourselves, it’s nice to give back from time to time. I've also noticed that it is now listed in the "most popular" category in the VisualStudio add new item.

EntityFramework Reverse POCO Code First Generator

Reverse engineers an existing database and generates EntityFramework Code First POCO classes, Configuration mappings and DbContext. To install and use this project: Use Nuget and install EntityFramework. Add a connect string to your app.config. Somethine like: In Visual Studio, right click project and select "add - new item". Select Online, and search for "reverse poco". Or you can download it from this page. Select "EntityFramework Reverse POCO Code First Generator". Give the file a name, such as Database.tt and click Add. Edit the Database.tt file and specify the connection string as MyDbContext which matches your name in app.config. Save the Database.tt file, which will now generate the Database.cs file. To see a video, head over to http://visualstudiogallery.msdn.microsoft.com/ee4fcff9-0c4c-4179-afd9-7a2fb90f5838

Obtaining the database schema, tables, columns, and primary keys in a single SQL call

I am currently writing an EntityFramework reverse engineer code-first generator. It will generate POCO classes, DbContext and Code First mapping for an existing database. There is one already in Entity Framework Power Tools Beta 2 However this one is going to do the job right, and include table filtering! Watch this space... SELECT [Extent1].[SchemaName], [Extent1].[Name] AS TableName, [Extent1].[TABLE_TYPE] AS TableType, [UnionAll1].[Ordinal], [UnionAll1].[Name] AS ColumnName, [UnionAll1].[IsNullable], [UnionAll1].[TypeName], ISNULL([UnionAll1].[MaxLength],0) AS MaxLength, ISNULL([UnionAll1].[Precision], 0) AS Precision, ISNULL([UnionAll1].[Default], '') AS [Default], ISNULL([UnionAll1].[DateTimePrecision], '') AS [DateTimePrecision], ISNULL([UnionAll1].[Scale], 0) AS Scale, [UnionAll1].[IsIdentity], [UnionAll1].[IsStoreGenerated], CASE WHEN ([Project5...