Quantcast
Channel: EntityFramework Reverse POCO Code First Generator
Viewing all 1642 articles
Browse latest View live

Edited Feature: The generated context class still implements IDbContextName if unit of work is disabled [152]

$
0
0
If Elements.UnitOfWork is omitted from ElementsToGenerate, the generated context class still implements the interface, despite the interface not actually being generated.

I temporarily fixed this around line 190 in EF.Reverse.POCO.ttinclude by adding an if (ElementsToGenerate.HasFlag(Elements.UnitOfWork)) wrapper around the interface inclusion.

Updated Wiki: What's new

$
0
0

Whats coming in the next release:

  1. Data Annotations.
  2. Regex schema filtering.

Whats new in v2.17.1:

  1. Case 162. Still using Async if TargetFrameworkVersion = "4.0". Thanks to cowpy520.
  2. Case 163. Handle views and table names with periods. Thanks to flodpanter.
  3. Changed NotNullable to be List<string> and include object. Thanks to philboyd.
  4. Include System.Collections.Generic if generating stored procedures.
  5. Finally sorted out Stored Procedure generation. You can now split out the interface/context/poco's with included stored procedures.
    For example, if you had 4 separate projects (extreme example) you can generate these with:
    • Configuration project: ElementsToGenerate = Elements.PocoConfiguration;
    • Context project: ElementsToGenerate = Elements.Context | Elements.StoredProcedures;
    • Entities project: ElementsToGenerate = Elements.Poco | Elements.StoredProcedures;
    • Interface project: ElementsToGenerate = Elements.UnitOfWork | Elements.StoredProcedures;

Whats new in v2.17.0:

  1. Case 156. Should get null instead of "NULL" for varchar DEFAULT NULL. Thanks toyyjdelete.
  2. Case 147: Add support for stored procedure user defined types. Thanks to mhwlng and Mathias.
  3. Add Find and FindAsync methods to FakeDbSet. Thanks to SoichiSaito.
  4. Changed the default for the IncludeExtendedPropertyComments to be InSummaryBlock so that if extended properties are present in the database, they provide intellisense for you.

Whats new in v2.16.1:

  1. Allow ColumnFilterExclude to target a specific Table.Schema.Column by including escaped dots in regex:
    "^Table\.dbo\.column$". Thanks to Paul Lively.
  2. Added support for EF6 Migration ContextKey. Thanks to ac_4.
  3. Case 154. Add precision and scale when using numeric parameters for stored procedures. Thanks to0v3rCl0ck.
  4. Case 148: No new line after each property "public DbSet" in DbContext. Thanks tosankan1gb.

Whats new in v2.16.0:

  1. Case 130. A new exciting feature: Support for multiple result sets returned from stored procedures.
  2. Fix bug: Stored Procedure with Nullable DateTime2 has invalid cast. Thanks toNeal Culiner.
  3. Mapping tables cannot include spaces in their name, so make them a regular table. Thanks toAndrey Stepanov Pro-Log.
  4. Made it possible to create a many-to-many relationship with the same table on each side. Thanks to Jon Califf.
  5. Case 151. ZapPassword doesn't replace passwords that don't have a trailing semicolon. Thanks toBrad Westness.
  6. Do not include excluded columns in POCO constructor. Thanks to Bacchus.
  7. Case 127. Fix bug where @ was removed from stored proc C# reserved word parameter. Thanks topinger.
  8. Case 144. Code clean up and bug fix. Thanks to jeffinflection.
  9. Better handling for property name clashes in columns. E.g. [user_id], [UserId], [user id] would all map to UserId
  10. Implemened fake functionality for SaveChangesAsync()
  11. Case 140. Include <auto-generated /> in the generated code when outputting separate files. Thanks toNeilCross andGeoArion.
  12. Case 53. Ignore read-only columns for determining mapping tables. Thanks to rvlieshout andpaultjls.
  13. Custom data annotations for ReverseNavigationProperty and ForeignKeys. Thanks toPetrettoS
  14. Corrected indent formatting of output

Whats new in v2.15.2:

  1. Make the FakeMyDbContext partial when MakeClassesPartial = true. Thanks to Police Officer.
  2. Case 140. Include <auto-generated /> in the generated code. Thanks to NeilCross andGeoArion.
  3. Case 142. Handle composite foreign keys. Thanks to GeoArion.
  4. Case 143. Add use of [DbFunctionDetails] attribute to specify schema name for TVF functions. Thanks tooatley.

Whats new in v2.15.1:

  1. Fix bug with stored procedure nullable parameters. Thanks to DannyGB.

Whats new in v2.15.0:

  1. For NTEXT fields, use .IsMaxLength(). Thanks to lucwuyts.
  2. Pass in false for the isFake parameter to WriteStoredProcFunctionSetSqlParameters when not generating a fake. Thanks toSur1969333.
  3. Ignore defaults we cannot interpret, such as "CREATE DEFAULT ..." (we would need SQL to C# compiler). Thanks tobooler.
  4. Case 133. Use full path for System.Threading.Tasks.Task to avoid clashes with table name 'Task'. Thanks toDominikDito.
  5. Case 89. Use DbSet instead of IDbSet. Thanks to 0v3rCl0ck.

Whats new in v2.14.3:

  1. Pluralize / Singularize just the last word if separated by underscore (schema_table) . Thanks toPetrettoS.
  2. Case 129. The Copyright use Western European Encoding for non-ascii char '©', and can not be recognized on other Encoding. I changed the copyright symbol to plain text. Thanks toyyjdelete.
    Copyright symbol
  3. Include schema name for enum definitions. Thanks to TheEdge3.
  4. Include .HasColumnType("sql type") in the configuration mappings. Thanks to lucwuyts.
  5. Added a parameterless constructor for the EntityTypeConfiguration classes. This is useful when you use your own context and use something likemodelBuilder.Configurations.AddFromAssembly(Assembly.GetExecutingAssembly()); when creating the model. Thanks tolucwuyts.
  6. If MakeClassesPartial=true, include a ctor even if there is no ICollection to initialise, so the call is made to InitializePartial();. Thanks tolucwuyts.

Whats new in v2.14.2:

  1. Case 128. Fixed Many-to-Many mapping for tables in different schemas. Thanks tocjmorelock.
  2. Include System.Data.SqlTypes if generating stored procedures as it's required for the INullable interface.

Whats new in v2.14.1:

  1. Handle stored procedure DBNull parameters. Thanks to rorourke.
  2. Handle stored procedure DBNull return values.
  3. Remove property restriction for HasDatabaseGeneratedOption. Thanks to fjrodriguez.

Whats new in v2.14.0:

  1. Handle a string default using the SPACE() keyword. Thanks to BBauer42.
  2. Case 125. Enable Computed Columns for type bool. Thanks to d1ner.
  3. Override Stored Procedure Return Types. Thanks to Leonard Lobel.
  4. Overloaded Stored Procedure Methods without procResult Output Parameter. Thanks toLeonard Lobel.
  5. Add enum property types support for columns. Thanks to Leonard Lobel.
  6. Added support for Azure databases. If the database is Azure, then sys.extended_properties is not used.
  7. Added support for Table Valued Functions. Thanks to Leonard Lobel. See the new variableIncludeTableValuedFunctions.
    The generator now produces strongly-typed wrappers for making TVF calls. They surface very much like stored procedures in the context, but the wrapper methods are implemented quite differently.
    Like stored procs, TVFs can be parameterized and can encapsulate custom server-side logic. But TVFs are alsocomposable, while stored procs aren’t. Meaning a LINQ query against a stored proc executes the where clause of the LINQ query on the client, whereas a LINQ query against a TVF translates the where clause of the LINQ query into a WHERE clause in T-SQL to run on the server.
    If the stored proc has a WHERE clause, then that will be executed on the server, but will then get filtered down further on the client, meaning that unneeded data was returned from the server. If the TVF has a WHERE clause, then that will also be executed on the server, but it will then get filtered down even further on the server with an “outer” WHERE clause generated by EF, meaning that no unneeded data gets returned from the server.
    If you want to use this new feature, you must also install the EntityFramework.CodeFirstStoreFunctions Nuget Package created byPawel Kadluczka (moozzyk) ex-EF team at Microsoft. Source code and documentation is herecodefirstfunctions.codeplex.com.
  8. Handle table names with underscores - singularise just the last word. i.e. Handle table names such as "IMPORTANT_THINGS" and just singuarlise the last 'word' to "ImportantThing". Thanks toDavid Gardiner.
  9. Added full namespace to database static initializer line to prevent some users experiencing compiler errors. Thanks toPaul McIlreavy.

Whats new in v2.13.1:

  1. Case 122. Bug Fix. Make use of the PrimaryKeyOrdinal for sorting when generating primary keys. Thanks tosamiljan.
  2. Fixed bug. In cases where a column had multiple foreign keys, only one foreign key was used. Thanks toChristopher Stamm.

Whats new in v2.13.0:

  1. { get; internal set; } for stored generated fields has been changed to { get; set; }. In some situations you may want to assign it manually, and another when serializing across a WCF service. The ID is lost when serializing because it was marked internal. Thanks to fjrodriguez.
  2. Bug fix: Exception was thrown when culture specific decimal separator was not '.'. Thanks toAndrew A. Evdokimov.
  3. Added the ability to specify base interfaces for the database context interface. See DbContextInterfaceBaseClasses. Thanks toDannyGB.
  4. Check for not nullable stored procedure parameters, such as string and byte[].

Whats new in v2.12.3:

  1. Remove use of [GeneratedCodeAttribute] where not necessary.
  2. Case 108. Include the schema when calling stored procedures. Thanks to emdadgar2.
  3. Case 109. Nullable uniqueidentifier with default value generates exception. Thanks tomarkuspeter.
  4. Case 107. Stored procedure return column name tidy up could bring all Null value. Thanks todisanxian.
  5. Case 106. Add support for async methods. Thanks to youngcm2.
  6. Changed the stored procedure parameters to be nullable. Thanks to Suraj Ramalingam.
  7. Case 110. Do not remove stored procedure where it has no return fields. Thanks toemdadgar2.

Whats new in v2.12.1:

  1. Case 101. SQL Server compact connection string only looks in current project. It now looks in all project paths for the SDF file, in a similar way to finding the app.config file for the connection string.
  2. Much faster TableSQL. Query plan cost is 97% vs 3%. Thanks to Glenn Orr.
  3. Much faster ForeignKeySQL. Query plan cost is 71% vs 29%.
  4. Unique indexes are now checked for. Previously, for tables without primary keys, all the NOT NULL columns used to be marked as a primary key. Now, if the table has a unique index, these unique index columns are used instead. However, the columns are still checked for being NOT NULL as entity framework will not allow a primary key to be made up of a column which can be NULLable.
  5. MakeClassesPartial flag now adds partial keyword to the stored procedure model classes.
  6. Added AdditionalContextInterfaceItems array to allow adding of extra functions to the db context interface.
  7. Fix schema prepending for Stored Procedures. Thanks to Emanov.
  8. Fix bug in MigrationStrategy when set to CreateDatabaseIfNotExists or DropCreateDatabaseIfModelChanges. Thanks toWill.
  9. Case 102. Stored procedures with no input parameters and all columns are nullable views cannot get populated in .cs. Thanks todisanxian.
  10. Calls to stored procedures are now placed in [square brackets] in case there are spaces in its name.
  11. Case 103. Check for column name C# reserved word name clashes. Thanks to swago.
  12. Do not include foreign keys which use composite keys.

Whats new in v2.11.0:

  1. Case 61. Allow excluding/modifying columns. Also permits you to run a function against each column to optionally modify the column properties (eg. to tweak the name of the generated property etc). Thanks toDavid Gardiner.
  2. Case 99. Add ability to specify additional using namespaces. Thanks to rorourke.
  3. Case 100. Apply GeneratedCodeAttribute to generated code. Thanks to David Gardiner.

Whats new in v2.10.2:

  1. Case 93. Merge logic for foreignKey column matching, previously .col=null was possible. Thanks toAHewgill.
  2. StoredProcs that return nullable binary types generate invalid "ReturnModel" code. Thanks toWallyHDisplayName.
  3. Case 96. Add a default for getutcdate(). Thanks to mbargar13.
  4. Case 94. Missing "using DatabaseGeneratedOption = System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption;" when targeting Framework 4.5. Thanks toalexdeblasis.
  5. StoredProcedureRename was being ignored. Thanks to slyCzar.
  6. Case 98. Corrected bridge table issue. Thanks to simooo985.

Whats new in v2.10.1:

  1. Stored Procedure arguments that are C# reserved keywords need escaping. Thanks toJimstr.
  2. Make mapping variables consistent during name clashes. An an edge case could cause different names for the reverse navigation as compared to the Map during name clashes. Thanks toFJRodriguez.
  3. Fix indentation when MakeClassesPartial is set.

Whats new in v2.10.0:

  1. Auto Migrations. To enable set MigrationConfigurationFileName to a class name, "MyDbContextDBMigrationConfiguration" for example. This enabled Entity Framework to update the schema when it is deployed in production. Thanks toFJRodriguez.
  2. Remove use of uses_native_compilation column in Stored Procedure SQL to support older database (< 2014). Thanks toNicholas Head.

Whats new in v2.9.1:

  1. GetSqlDbType was missing some types (nvarchar, and uniqueidentifier). Thanks toWally.
  2. Add in "using System.Linq" if Elements.StoredProcedures declared and not Elements.Context. Thanks toWally.

Whats new in v2.9.0:

  1. Stored procedure support !
    • This includes the ability to retrieve the RESULT from stored procs, as well as the data. A result of 0 means success, any other value is an error.
    • Include stubs for the stored procs in the FakeDbContext.
  2. Sort contents of HasForeignKey(...) by foreign key ordinal.
  3. Prevent creating maps where the left and right side of the map are the same table.
  4. Use a try/catch for WCF projects. Thanks to FJRodriguez.
  5. Include examples of CustomPluralizationEntry. Thanks to Carrie Kroutil.
  6. Allow for manual setting of the targeted .Net framework version.

Whats new in v2.8.3:

  1. Added new setting IncludeQueryTraceOn9481Flag so that you are now in control if "OPTION (QUERYTRACEON 9481)" is appended to the SQL. SqlServer 2014 is known to appear frozen / take a long time when this file is saved. If it does, set this to true (however you will also need elevated privileges).
  2. Added new setting DbContextBaseClass. You can now specify what the base class for your DbContext class is. For example ASP.NET Identity use "IdentityDbContext<ApplicationUser>", or even go so far as a custom: IdentityDbContext<CustomUser, CustomRole, int, CustomUserLogin, CustomUserRole, CustomUserClaim>. Thanks toParag Shravagi.
  3. Fixed bug: IndexOutOfRangeException thrown inside GetCurrentProject. Thanks toDavid Gardiner.
    https://efreversepoco.codeplex.com/workitem/85

Whats new in v2.8.2:

  1. This update is required to fix a problem with Sql Server 2014 as it freezes when obtaining the Foreign Keys. See here for more info. The solution was to add OPTION (QUERYTRACEON 9481). Thanks to@ErikEJ for the solution.
    Using this option flag needs a higher SQL privilege, so you may experience:
    User 'Your.Name' does not have permission to run DBCC TRACEON.
    More info (requires sysadmin rights) http://spaghettidba.com/2013/02/08/using-querytraceon-in-plan-guides/ 

Whats new in v2.8.1:

  1. Bug fix: If property had _ appended, and is used as key, it breaks template generation. Thanks toNicholas Head.

Whats new in v2.8.0:

  1. Added a new flag: AddUnitTestingDbContext. If true, this will create a Fake DbContext and a FakeDbSet<T>. This will allow easy unit testing. Can't believe I never added this sooner. See the documentation Unit Testing.

Whats new in v2.7.0:

  1. Fixed bug: Missing schema specification in ManyToMany tables. Thanks to Vtanman & Snajahi.
  2. Add a timeout when obtaining the schema info from a slow database. Thanks to DotNetWise.
  3. Changed table renaming to use a function. Thanks to DotNetWise.

Whats new in v2.6.3:

  1. Add IsUnicode(false) for the char/varchar columns. Thanks to Naomi N.
  2. Rollback a feature added in 2.5.1: For database types such as Numeric(17,0), the C# type should resolve to something in the "int" family. Thanks toSimmered.

Whats new in v2.6.2:

  1. Include another namespace if Target framework is not 4.0. Thanks to NazmulRockOn.
  2. CR/LF in extended properties caused errors. Thanks to Simmered.
  3. Use IsFixedLength() for char/nchar types. Thanks to Naomi N.

Whats new in v2.6.1:

  1. Added the same extended properties comments facility for SQL CE. Thanks to @ErikEJ

Whats new in v2.6.0:

  1. It now reads the extended properties and can add them to the poco classes in comments. See the new IncludeExtendedPropertyComments flag which is an enumeration of
[Flags]
public enum ExtendedPropertyCommentsStyle
{
  None,
  InSummaryBlock,
  AtEndOfField
};
  • ExtendedPropertyCommentsStyle.None: No extended properties are shown.
  • ExtendedPropertyCommentsStyle.InSummaryBlock: extended properties are shown above field in a ///<summary> block.
  • ExtendedPropertyCommentsStyle.AtEndOfField: extended properties are shown at the end of the field in a comment block.

The IncludeComments flag is completely independent to IncludeExtendedPropertyComments.

If you want completely comment free generate code, set IncludeComments = false, and IncludeExtendedPropertyComments = ExtendedPropertyCommentsStyle.None;

Whats new in v2.5.1:

  1. Move the call to tables.SetPrimaryKeys(); higher up. This allows support of tables with no primary keys to be able to be used. Thanks toJaved.
  2. For database types such as Numeric(17,0), the C# type should resolve to something in the "int" family. Thanks tosimmered.

Whats new in v2.5.0:

  1. Added option to strip and alter table names. Such as tblOrders to Orders, AB_Shipments to Shipments, etc. See Table renaming section.
  2. Added ability to switch off the Pluralization service.
  3. Added ability to use other Pluralization services, such as the SpanishPluralizationService as provided in the "EF6.Contrib" Nuget Package. If you are to use the SpanishPluralizationService, add the following to the top of your database.tt file: <#@ assembly name="C:\<Your path here>\packages\EF6.Contrib.1.0.5\lib\net45\EntityFramework.Contrib.dll" #> Changing the path to where your DLL is situated.

Whats new in v2.4.1:

  1.  Fixed bug: When using .HasForeignKey(...) for multi-column keys, the columns should be listed in ordinal order. Thanks toScott Hodges.

Whats new in v2.4.0

  1. Removed use of System.Data.Entity.DLL from the installation template as it is no longer required for EF 6.
  2. Moved spatial types from System.Data.Spatial to System.Data.Entity.Spatial for EF 6.
  3. Singular names and camel casing configuration were accidentally combined by using the UseCamelCase boolean. Thanks toRune Gulbrandsen.
  4. Added new flag IncludeComments. This controls the generation of comments in the output.
  5. Fixed bug in constructor where a UNIQUEIDENTIFIER column had default value. Thanks togonglei.

Whats new in v2.3.2

  1. Singularize one-to-one Reverse Navigation. Thanks to StormRider.
  2. Bugfix for IsRowVersion() for timestamp columns. Thanks to StormRider.
  3. Do not append "m" to decimal value in poco ctor if default contains an unparsable value.

Whats new in v2.3.0:

  1. SQL Server Compact 4.0 support. Thanks to ErikEJ.

Whats new in v2.2.1:

  1. Add strings to be allowed as computed columns. Thanks to JBJBJB and BrhineScot.
  2. Now includes callbacks during code generation. This means you can add attributes to classes, specify a base class, specify custom code within the class, and finally a call back for each column within the class. Thanks toSimplyFoolish
  3. OData doesn't support entities with geometery/geography types. Provided a flag to turn these off if entities are being generated from ODATA.  Thanks toSimplyFoolish. Flag is called DisableGeographyTypes.
  4. Fixed bug with the Pluralisation service. If your current culture was not en, then it would throw an exception. Thanks toErikEJ.

Whats new in v2.2.0:

  1. Now uses the .Net Pluralization service. Thanks to James Manning.
  2. Bug fixed when you have foreign keys between two tables where the FK/PK columns have spaces in the column name. Thanks toColin Smith.
  3. Bug fixed. Solution Folders are not searched for config settings. Thanks to scaftw.
  4. Generate navigation property based on FK name. If there are two FK links to a table, the second link would appear as linkName1. This is now detected and both the FK properties will make use of the FK name. If only one FK is used, then the FK name is not appended to the table name. Thanks to saber_solomon.
  5. Sort the generated Reverse navigation and foriegn keys in POCO classes.

Whats new in v2.1.0:

  1. Fixed bug if default constraint was not in expected format. Thanks to Filipe Fujiy.
  2. Now detects name clashes with C# keywords.
  3. Added "System." to DateTime.Now(), etc to prevent clashes with table field names.
  4. "Configuration" class names are now configurable as "Mapping", "Map", etc.
  5. Added support for Spatial.DbGeometry and Spatial.DbGeography. Thanks to Simply Foolish andJorge Bustos.
  6. Can now have custom collection type for Navigation Properties. "ObservableCollection" for example. Thanks to Simply Foolish.

Whats new in v2.0:

  1. Fixed issue when running 'Transform All T4 Templates' from Visual Studio Build Menu.Thanks to JRoselle.
  2. Changing mappings during runtime is not possible/expensive. A specific DbModelBuilder can be used for each needed database schema.Thanks to meixger.
  3. Added ability to detect and use .IsRowVersion().
  4. 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:

  1. VARBINARY(MAX) is now correctly assigned to byte[]. Thanks to Luke91577.
  2. Extending partial class support. Allow specification of file extension for partial classes (i.e. ".generated.cs").Thanks to AB_dreeve.
  3. Fixes issues when targeting .NET 4. .NET 4.0 doesn't include the System.ComponentModel.DataAnnotations.Schema namespace, allow specification of TargetFrameworkVersion.Thanks to AB_dreeve.

Whats new in v1.11:

  1. Including views is now working. For a view to be included, at least one column must not be nullable.Thanks to Delmo Carruzzo.
  2. Added selective generation of components (Poco, Context, UnitOfWork, PocoConfiguration). You can now build entities in your Model project, and context, configuration, unit of work in your Data project. Thanks to kscelfo.
  3. Added PrependSchemaName flag. You can now control if the schema name is prepended to the table name. Thanks to kscelfo.

Whats new in v1.10:

  1. Added UseCamelCase flag to the tt file. You can now control if you want your table and column names CamelCase or left alone: i.e. FieldPersonOrder or field_person_order

Whats new in v1.9.2:

  1. Removed the Linq de-duplication code as it is now being done in SQL. The Linq version did not include the schema name when de-duplicating FK's.

Whats new in v1.9.1:

  1. Added DISTICT to the foreign key SQL. This prevents duplicates from appearing.
    They can appear with SQL such as:
    ALTERTABLE [Mars].[Table2] WITHCHECKADDCONSTRAINT [FK_Table2_Table1]
    FOREIGNKEY([Table1Id]) REFERENCES [Mars].[Table1] ([Id]) ALTERTABLE [Mars].[Table2] CHECKCONSTRAINT [FK_Table2_Table1]

Whats new in v1.9.0:

  1. It now has the ability to read connection strings from other config files/projects.
    It starts by looking at the local project for the named connection string in the following files:
    • app.config
    • web.config
    • app.config.transform
    • web.config.transform
    • or edit the above list in the .tt and specify which file(s) to use
    If not found, it then looks for those files in all the projects within the solution.

Whats new in v1.8.0:

  1. Can now optionally generate separate files. See the new boolean flag GenerateSeparateFiles.
  2. Removed the hard coded 300 second timeout. The timeout can be specified in the connection string.

Whats new in v1.7.1:

  1. Add support for DateTime2
  2. Add support for UnitOfWork and the repository pattern. This means you can now unit test your repositories. See the source code for examples.
  3. Add IDisposable to db context.

Whats new in v1.7.0:

  1. Add .HasPrecision(precision, scale) for fields that have scale. Thanks to @choudeshell

Whats new in v1.6.0:

  1. Enhance ReadSchema performance with early table exclusion.
  2. Now supports columns with symbols and punctuation.
  3. Handles decimal default values.

Whats new in v1.5.1:

  1. A bugfix for WCF. See issue https://efreversepoco.codeplex.com/workitem/4

Whats new in v1.5.0:

  1. Ability to add WCF(DataMember, DataContract attributes) support on Entity. Requested by spatemp

Whats new in v1.4.1:

  1. Foreign keys are only included if they point to a primary key.

Whats new in v1.4.0:

  1. If a field has a default contrainst of GetDate(), add DateTime.Now() in the ctor for the field.
  2. Add support for the datetimeoffset type, including support for the default constraint sysdatetimeoffset().
  3. Add Resharper naming comments.
  4. Mappings should be marked internal. Requested by Hobbes Pirakitti

New Post: Exclude schema tables, rename (hide schema prefix)

$
0
0
I have now added full regex schema filtering.
Download the latest source code.

New Post: Exclude schema tables, rename (hide schema prefix)

$
0
0
Hi Simon.

I have a special requirement for filtering for a DbContext:

All stored procedures in a schema (not dbo) combined with a number of tables from the dbo schema.

It looks like the current implementation of the stored procedure name filter only looks at the stored procedure name, not the schema.

Any bright ideas? Or is a special "StoredProc" regex property needed?

Commented Unassigned: lambda expresion for ReverseNavigationProperty + entityFk [165]

$
0
0
Hi,
You have a lambda expresion for columns, in "EF.Reverse.POCO.ttinclude":

```
<#if(isIncludeClassProperties){#>
<#= WritePocoColumn(col) #>
<# } #>

```
that can be set in the .tt file.

But the other columns that are relations in nature, does not, as you can see in "EF.Reverse.POCO.ttinclude" for the "ReverseNavigationProperty", and the EntityFk:

```
if(isIncludeClassNavigationProperties) if(tbl.ReverseNavigationProperty.Count() > 0)
{
#>

<#if(IncludeComments){#> // Reverse navigation
<# } #>
<#
foreach(string s in tbl.ReverseNavigationProperty.OrderBy(x => x))
{
foreach (var rnpda in AdditionalReverseNavigationsDataAnnotations) {#>
[<#=rnpda #>]
<# } #>
<#=s #>
<# } } #>
<# if(tbl.HasForeignKey) { #>

<#if(IncludeComments){#> // Foreign keys
<# } #>
<#
foreach(var entityFk in tbl.Columns.SelectMany(x => x.EntityFk).OrderBy(o => o))
{
foreach (var fkda in AdditionalForeignKeysDataAnnotations) {#>
[<#=fkda #>]
<# } #>
<#=entityFk #>
<# } } #>
<#
```

so if both the "s" and the "entityFk" variables can be changed to a lambda that are set in the .tt, then we can do anything we have done to normal columns, through their lambda expresions.

Regards.

Comments: Hi, I wanna customize some foreign keys with my own rules. Like de updateColumn and tableName lambda expresions.

New Post: Exclude schema tables, rename (hide schema prefix)

$
0
0
Hi Erik,

Set the database.tt schema filter include to be new Regex("dbo"); That will filter both the stored procs and tables for 'dbo' only.

As you want stored procs in non-dbo schema, in EF.Reverse.POCO.Core.ttinclude file, modify the ReadStoredProcs() function and add the code shown below to the first line:
schemaFilterExclude = null;

New Post: Exclude schema tables, rename (hide schema prefix)

$
0
0
Hi Simon,

Not sure that it fullfills my requirement.

I want all stored procedures in schema: "utility" + a selection of tables in the dbo schema in my DbContext.

Source code checked in, #a04760441c1d


Closed Feature: The generated context class still implements IDbContextName if unit of work is disabled [152]

$
0
0
If Elements.UnitOfWork is omitted from ElementsToGenerate, the generated context class still implements the interface, despite the interface not actually being generated.

I temporarily fixed this around line 190 in EF.Reverse.POCO.ttinclude by adding an if (ElementsToGenerate.HasFlag(Elements.UnitOfWork)) wrapper around the interface inclusion.
Comments: Always code against interfaces. Its the I in SOLID. https://en.wikipedia.org/wiki/SOLID_%28object-oriented_design%29

Created Feature: Minimise usings to the bare minimum required [172]

$
0
0
There are too many using statements which are not required if the code is outputted on a file by file basis.

New Post: donation + some feature requests

$
0
0
"SchemaFilterExclude" and "SchemaFilterInclude", like you did it for tables would be helpful.

This is now in release v2.17.2

Edited Feature: Provide a schema filter to in/exclude tables [47]

$
0
0
Allow the user to filter tables with a Regex according to the schema the table belongs to. For instance include all tables in schema dbo, similar like the filter for tablenames.

Updated Wiki: What's new

$
0
0

Whats coming in the next major release:

  1. Data Annotations.

Whats new in v2.17.2:

  1. Regex schema filtering.
  2. Case 166. Remove "Elements.StoredProcedures" causes build errors. Thanks to bbieb.
  3. Support HierarchyId.
  4. Prevent the use of tables which contain periods '.' as these are invalid within entity framework.
  5. Case 167. Fix ColumnFilter fully qualified name check is schema.table.columnName. Thanks toAndyGJP.

Whats new in v2.17.1:

  1. Case 162. Still using Async if TargetFrameworkVersion = "4.0". Thanks to cowpy520.
  2. Case 163. Handle views and table names with periods. Thanks to flodpanter.
  3. Changed NotNullable to be List<string> and include object. Thanks to philboyd.
  4. Include System.Collections.Generic if generating stored procedures.
  5. Finally sorted out Stored Procedure generation. You can now split out the interface/context/poco's with included stored procedures.
    For example, if you had 4 separate projects (extreme example) you can generate these with:
    • Configuration project: ElementsToGenerate = Elements.PocoConfiguration;
    • Context project: ElementsToGenerate = Elements.Context | Elements.StoredProcedures;
    • Entities project: ElementsToGenerate = Elements.Poco | Elements.StoredProcedures;
    • Interface project: ElementsToGenerate = Elements.UnitOfWork | Elements.StoredProcedures;

Whats new in v2.17.0:

  1. Case 156. Should get null instead of "NULL" for varchar DEFAULT NULL. Thanks toyyjdelete.
  2. Case 147: Add support for stored procedure user defined types. Thanks to mhwlng and Mathias.
  3. Add Find and FindAsync methods to FakeDbSet. Thanks to SoichiSaito.
  4. Changed the default for the IncludeExtendedPropertyComments to be InSummaryBlock so that if extended properties are present in the database, they provide intellisense for you.

Whats new in v2.16.1:

  1. Allow ColumnFilterExclude to target a specific Table.Schema.Column by including escaped dots in regex:
    "^Table\.dbo\.column$". Thanks to Paul Lively.
  2. Added support for EF6 Migration ContextKey. Thanks to ac_4.
  3. Case 154. Add precision and scale when using numeric parameters for stored procedures. Thanks to0v3rCl0ck.
  4. Case 148: No new line after each property "public DbSet" in DbContext. Thanks tosankan1gb.

Whats new in v2.16.0:

  1. Case 130. A new exciting feature: Support for multiple result sets returned from stored procedures.
  2. Fix bug: Stored Procedure with Nullable DateTime2 has invalid cast. Thanks toNeal Culiner.
  3. Mapping tables cannot include spaces in their name, so make them a regular table. Thanks toAndrey Stepanov Pro-Log.
  4. Made it possible to create a many-to-many relationship with the same table on each side. Thanks to Jon Califf.
  5. Case 151. ZapPassword doesn't replace passwords that don't have a trailing semicolon. Thanks toBrad Westness.
  6. Do not include excluded columns in POCO constructor. Thanks to Bacchus.
  7. Case 127. Fix bug where @ was removed from stored proc C# reserved word parameter. Thanks topinger.
  8. Case 144. Code clean up and bug fix. Thanks to jeffinflection.
  9. Better handling for property name clashes in columns. E.g. [user_id], [UserId], [user id] would all map to UserId
  10. Implemened fake functionality for SaveChangesAsync()
  11. Case 140. Include <auto-generated /> in the generated code when outputting separate files. Thanks toNeilCross andGeoArion.
  12. Case 53. Ignore read-only columns for determining mapping tables. Thanks to rvlieshout andpaultjls.
  13. Custom data annotations for ReverseNavigationProperty and ForeignKeys. Thanks toPetrettoS
  14. Corrected indent formatting of output

Whats new in v2.15.2:

  1. Make the FakeMyDbContext partial when MakeClassesPartial = true. Thanks to Police Officer.
  2. Case 140. Include <auto-generated /> in the generated code. Thanks to NeilCross andGeoArion.
  3. Case 142. Handle composite foreign keys. Thanks to GeoArion.
  4. Case 143. Add use of [DbFunctionDetails] attribute to specify schema name for TVF functions. Thanks tooatley.

Whats new in v2.15.1:

  1. Fix bug with stored procedure nullable parameters. Thanks to DannyGB.

Whats new in v2.15.0:

  1. For NTEXT fields, use .IsMaxLength(). Thanks to lucwuyts.
  2. Pass in false for the isFake parameter to WriteStoredProcFunctionSetSqlParameters when not generating a fake. Thanks toSur1969333.
  3. Ignore defaults we cannot interpret, such as "CREATE DEFAULT ..." (we would need SQL to C# compiler). Thanks tobooler.
  4. Case 133. Use full path for System.Threading.Tasks.Task to avoid clashes with table name 'Task'. Thanks toDominikDito.
  5. Case 89. Use DbSet instead of IDbSet. Thanks to 0v3rCl0ck.

Whats new in v2.14.3:

  1. Pluralize / Singularize just the last word if separated by underscore (schema_table) . Thanks toPetrettoS.
  2. Case 129. The Copyright use Western European Encoding for non-ascii char '©', and can not be recognized on other Encoding. I changed the copyright symbol to plain text. Thanks toyyjdelete.
    Copyright symbol
  3. Include schema name for enum definitions. Thanks to TheEdge3.
  4. Include .HasColumnType("sql type") in the configuration mappings. Thanks to lucwuyts.
  5. Added a parameterless constructor for the EntityTypeConfiguration classes. This is useful when you use your own context and use something likemodelBuilder.Configurations.AddFromAssembly(Assembly.GetExecutingAssembly()); when creating the model. Thanks tolucwuyts.
  6. If MakeClassesPartial=true, include a ctor even if there is no ICollection to initialise, so the call is made to InitializePartial();. Thanks tolucwuyts.

Whats new in v2.14.2:

  1. Case 128. Fixed Many-to-Many mapping for tables in different schemas. Thanks tocjmorelock.
  2. Include System.Data.SqlTypes if generating stored procedures as it's required for the INullable interface.

Whats new in v2.14.1:

  1. Handle stored procedure DBNull parameters. Thanks to rorourke.
  2. Handle stored procedure DBNull return values.
  3. Remove property restriction for HasDatabaseGeneratedOption. Thanks to fjrodriguez.

Whats new in v2.14.0:

  1. Handle a string default using the SPACE() keyword. Thanks to BBauer42.
  2. Case 125. Enable Computed Columns for type bool. Thanks to d1ner.
  3. Override Stored Procedure Return Types. Thanks to Leonard Lobel.
  4. Overloaded Stored Procedure Methods without procResult Output Parameter. Thanks toLeonard Lobel.
  5. Add enum property types support for columns. Thanks to Leonard Lobel.
  6. Added support for Azure databases. If the database is Azure, then sys.extended_properties is not used.
  7. Added support for Table Valued Functions. Thanks to Leonard Lobel. See the new variableIncludeTableValuedFunctions.
    The generator now produces strongly-typed wrappers for making TVF calls. They surface very much like stored procedures in the context, but the wrapper methods are implemented quite differently.
    Like stored procs, TVFs can be parameterized and can encapsulate custom server-side logic. But TVFs are alsocomposable, while stored procs aren’t. Meaning a LINQ query against a stored proc executes the where clause of the LINQ query on the client, whereas a LINQ query against a TVF translates the where clause of the LINQ query into a WHERE clause in T-SQL to run on the server.
    If the stored proc has a WHERE clause, then that will be executed on the server, but will then get filtered down further on the client, meaning that unneeded data was returned from the server. If the TVF has a WHERE clause, then that will also be executed on the server, but it will then get filtered down even further on the server with an “outer” WHERE clause generated by EF, meaning that no unneeded data gets returned from the server.
    If you want to use this new feature, you must also install the EntityFramework.CodeFirstStoreFunctions Nuget Package created byPawel Kadluczka (moozzyk) ex-EF team at Microsoft. Source code and documentation is herecodefirstfunctions.codeplex.com.
  8. Handle table names with underscores - singularise just the last word. i.e. Handle table names such as "IMPORTANT_THINGS" and just singuarlise the last 'word' to "ImportantThing". Thanks toDavid Gardiner.
  9. Added full namespace to database static initializer line to prevent some users experiencing compiler errors. Thanks toPaul McIlreavy.

Whats new in v2.13.1:

  1. Case 122. Bug Fix. Make use of the PrimaryKeyOrdinal for sorting when generating primary keys. Thanks tosamiljan.
  2. Fixed bug. In cases where a column had multiple foreign keys, only one foreign key was used. Thanks toChristopher Stamm.

Whats new in v2.13.0:

  1. { get; internal set; } for stored generated fields has been changed to { get; set; }. In some situations you may want to assign it manually, and another when serializing across a WCF service. The ID is lost when serializing because it was marked internal. Thanks to fjrodriguez.
  2. Bug fix: Exception was thrown when culture specific decimal separator was not '.'. Thanks toAndrew A. Evdokimov.
  3. Added the ability to specify base interfaces for the database context interface. See DbContextInterfaceBaseClasses. Thanks toDannyGB.
  4. Check for not nullable stored procedure parameters, such as string and byte[].

Whats new in v2.12.3:

  1. Remove use of [GeneratedCodeAttribute] where not necessary.
  2. Case 108. Include the schema when calling stored procedures. Thanks to emdadgar2.
  3. Case 109. Nullable uniqueidentifier with default value generates exception. Thanks tomarkuspeter.
  4. Case 107. Stored procedure return column name tidy up could bring all Null value. Thanks todisanxian.
  5. Case 106. Add support for async methods. Thanks to youngcm2.
  6. Changed the stored procedure parameters to be nullable. Thanks to Suraj Ramalingam.
  7. Case 110. Do not remove stored procedure where it has no return fields. Thanks toemdadgar2.

Whats new in v2.12.1:

  1. Case 101. SQL Server compact connection string only looks in current project. It now looks in all project paths for the SDF file, in a similar way to finding the app.config file for the connection string.
  2. Much faster TableSQL. Query plan cost is 97% vs 3%. Thanks to Glenn Orr.
  3. Much faster ForeignKeySQL. Query plan cost is 71% vs 29%.
  4. Unique indexes are now checked for. Previously, for tables without primary keys, all the NOT NULL columns used to be marked as a primary key. Now, if the table has a unique index, these unique index columns are used instead. However, the columns are still checked for being NOT NULL as entity framework will not allow a primary key to be made up of a column which can be NULLable.
  5. MakeClassesPartial flag now adds partial keyword to the stored procedure model classes.
  6. Added AdditionalContextInterfaceItems array to allow adding of extra functions to the db context interface.
  7. Fix schema prepending for Stored Procedures. Thanks to Emanov.
  8. Fix bug in MigrationStrategy when set to CreateDatabaseIfNotExists or DropCreateDatabaseIfModelChanges. Thanks toWill.
  9. Case 102. Stored procedures with no input parameters and all columns are nullable views cannot get populated in .cs. Thanks todisanxian.
  10. Calls to stored procedures are now placed in [square brackets] in case there are spaces in its name.
  11. Case 103. Check for column name C# reserved word name clashes. Thanks to swago.
  12. Do not include foreign keys which use composite keys.

Whats new in v2.11.0:

  1. Case 61. Allow excluding/modifying columns. Also permits you to run a function against each column to optionally modify the column properties (eg. to tweak the name of the generated property etc). Thanks toDavid Gardiner.
  2. Case 99. Add ability to specify additional using namespaces. Thanks to rorourke.
  3. Case 100. Apply GeneratedCodeAttribute to generated code. Thanks to David Gardiner.

Whats new in v2.10.2:

  1. Case 93. Merge logic for foreignKey column matching, previously .col=null was possible. Thanks toAHewgill.
  2. StoredProcs that return nullable binary types generate invalid "ReturnModel" code. Thanks toWallyHDisplayName.
  3. Case 96. Add a default for getutcdate(). Thanks to mbargar13.
  4. Case 94. Missing "using DatabaseGeneratedOption = System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption;" when targeting Framework 4.5. Thanks toalexdeblasis.
  5. StoredProcedureRename was being ignored. Thanks to slyCzar.
  6. Case 98. Corrected bridge table issue. Thanks to simooo985.

Whats new in v2.10.1:

  1. Stored Procedure arguments that are C# reserved keywords need escaping. Thanks toJimstr.
  2. Make mapping variables consistent during name clashes. An an edge case could cause different names for the reverse navigation as compared to the Map during name clashes. Thanks toFJRodriguez.
  3. Fix indentation when MakeClassesPartial is set.

Whats new in v2.10.0:

  1. Auto Migrations. To enable set MigrationConfigurationFileName to a class name, "MyDbContextDBMigrationConfiguration" for example. This enabled Entity Framework to update the schema when it is deployed in production. Thanks toFJRodriguez.
  2. Remove use of uses_native_compilation column in Stored Procedure SQL to support older database (< 2014). Thanks toNicholas Head.

Whats new in v2.9.1:

  1. GetSqlDbType was missing some types (nvarchar, and uniqueidentifier). Thanks toWally.
  2. Add in "using System.Linq" if Elements.StoredProcedures declared and not Elements.Context. Thanks toWally.

Whats new in v2.9.0:

  1. Stored procedure support !
    • This includes the ability to retrieve the RESULT from stored procs, as well as the data. A result of 0 means success, any other value is an error.
    • Include stubs for the stored procs in the FakeDbContext.
  2. Sort contents of HasForeignKey(...) by foreign key ordinal.
  3. Prevent creating maps where the left and right side of the map are the same table.
  4. Use a try/catch for WCF projects. Thanks to FJRodriguez.
  5. Include examples of CustomPluralizationEntry. Thanks to Carrie Kroutil.
  6. Allow for manual setting of the targeted .Net framework version.

Whats new in v2.8.3:

  1. Added new setting IncludeQueryTraceOn9481Flag so that you are now in control if "OPTION (QUERYTRACEON 9481)" is appended to the SQL. SqlServer 2014 is known to appear frozen / take a long time when this file is saved. If it does, set this to true (however you will also need elevated privileges).
  2. Added new setting DbContextBaseClass. You can now specify what the base class for your DbContext class is. For example ASP.NET Identity use "IdentityDbContext<ApplicationUser>", or even go so far as a custom: IdentityDbContext<CustomUser, CustomRole, int, CustomUserLogin, CustomUserRole, CustomUserClaim>. Thanks toParag Shravagi.
  3. Fixed bug: IndexOutOfRangeException thrown inside GetCurrentProject. Thanks toDavid Gardiner.
    https://efreversepoco.codeplex.com/workitem/85

Whats new in v2.8.2:

  1. This update is required to fix a problem with Sql Server 2014 as it freezes when obtaining the Foreign Keys. See here for more info. The solution was to add OPTION (QUERYTRACEON 9481). Thanks to@ErikEJ for the solution.
    Using this option flag needs a higher SQL privilege, so you may experience:
    User 'Your.Name' does not have permission to run DBCC TRACEON.
    More info (requires sysadmin rights) http://spaghettidba.com/2013/02/08/using-querytraceon-in-plan-guides/ 

Whats new in v2.8.1:

  1. Bug fix: If property had _ appended, and is used as key, it breaks template generation. Thanks toNicholas Head.

Whats new in v2.8.0:

  1. Added a new flag: AddUnitTestingDbContext. If true, this will create a Fake DbContext and a FakeDbSet<T>. This will allow easy unit testing. Can't believe I never added this sooner. See the documentation Unit Testing.

Whats new in v2.7.0:

  1. Fixed bug: Missing schema specification in ManyToMany tables. Thanks to Vtanman & Snajahi.
  2. Add a timeout when obtaining the schema info from a slow database. Thanks to DotNetWise.
  3. Changed table renaming to use a function. Thanks to DotNetWise.

Whats new in v2.6.3:

  1. Add IsUnicode(false) for the char/varchar columns. Thanks to Naomi N.
  2. Rollback a feature added in 2.5.1: For database types such as Numeric(17,0), the C# type should resolve to something in the "int" family. Thanks toSimmered.

Whats new in v2.6.2:

  1. Include another namespace if Target framework is not 4.0. Thanks to NazmulRockOn.
  2. CR/LF in extended properties caused errors. Thanks to Simmered.
  3. Use IsFixedLength() for char/nchar types. Thanks to Naomi N.

Whats new in v2.6.1:

  1. Added the same extended properties comments facility for SQL CE. Thanks to @ErikEJ

Whats new in v2.6.0:

  1. It now reads the extended properties and can add them to the poco classes in comments. See the new IncludeExtendedPropertyComments flag which is an enumeration of
[Flags]
public enum ExtendedPropertyCommentsStyle
{
  None,
  InSummaryBlock,
  AtEndOfField
};
  • ExtendedPropertyCommentsStyle.None: No extended properties are shown.
  • ExtendedPropertyCommentsStyle.InSummaryBlock: extended properties are shown above field in a ///<summary> block.
  • ExtendedPropertyCommentsStyle.AtEndOfField: extended properties are shown at the end of the field in a comment block.

The IncludeComments flag is completely independent to IncludeExtendedPropertyComments.

If you want completely comment free generate code, set IncludeComments = false, and IncludeExtendedPropertyComments = ExtendedPropertyCommentsStyle.None;

Whats new in v2.5.1:

  1. Move the call to tables.SetPrimaryKeys(); higher up. This allows support of tables with no primary keys to be able to be used. Thanks toJaved.
  2. For database types such as Numeric(17,0), the C# type should resolve to something in the "int" family. Thanks tosimmered.

Whats new in v2.5.0:

  1. Added option to strip and alter table names. Such as tblOrders to Orders, AB_Shipments to Shipments, etc. See Table renaming section.
  2. Added ability to switch off the Pluralization service.
  3. Added ability to use other Pluralization services, such as the SpanishPluralizationService as provided in the "EF6.Contrib" Nuget Package. If you are to use the SpanishPluralizationService, add the following to the top of your database.tt file: <#@ assembly name="C:\<Your path here>\packages\EF6.Contrib.1.0.5\lib\net45\EntityFramework.Contrib.dll" #> Changing the path to where your DLL is situated.

Whats new in v2.4.1:

  1.  Fixed bug: When using .HasForeignKey(...) for multi-column keys, the columns should be listed in ordinal order. Thanks toScott Hodges.

Whats new in v2.4.0

  1. Removed use of System.Data.Entity.DLL from the installation template as it is no longer required for EF 6.
  2. Moved spatial types from System.Data.Spatial to System.Data.Entity.Spatial for EF 6.
  3. Singular names and camel casing configuration were accidentally combined by using the UseCamelCase boolean. Thanks toRune Gulbrandsen.
  4. Added new flag IncludeComments. This controls the generation of comments in the output.
  5. Fixed bug in constructor where a UNIQUEIDENTIFIER column had default value. Thanks togonglei.

Whats new in v2.3.2

  1. Singularize one-to-one Reverse Navigation. Thanks to StormRider.
  2. Bugfix for IsRowVersion() for timestamp columns. Thanks to StormRider.
  3. Do not append "m" to decimal value in poco ctor if default contains an unparsable value.

Whats new in v2.3.0:

  1. SQL Server Compact 4.0 support. Thanks to ErikEJ.

Whats new in v2.2.1:

  1. Add strings to be allowed as computed columns. Thanks to JBJBJB and BrhineScot.
  2. Now includes callbacks during code generation. This means you can add attributes to classes, specify a base class, specify custom code within the class, and finally a call back for each column within the class. Thanks toSimplyFoolish
  3. OData doesn't support entities with geometery/geography types. Provided a flag to turn these off if entities are being generated from ODATA.  Thanks toSimplyFoolish. Flag is called DisableGeographyTypes.
  4. Fixed bug with the Pluralisation service. If your current culture was not en, then it would throw an exception. Thanks toErikEJ.

Whats new in v2.2.0:

  1. Now uses the .Net Pluralization service. Thanks to James Manning.
  2. Bug fixed when you have foreign keys between two tables where the FK/PK columns have spaces in the column name. Thanks toColin Smith.
  3. Bug fixed. Solution Folders are not searched for config settings. Thanks to scaftw.
  4. Generate navigation property based on FK name. If there are two FK links to a table, the second link would appear as linkName1. This is now detected and both the FK properties will make use of the FK name. If only one FK is used, then the FK name is not appended to the table name. Thanks to saber_solomon.
  5. Sort the generated Reverse navigation and foriegn keys in POCO classes.

Whats new in v2.1.0:

  1. Fixed bug if default constraint was not in expected format. Thanks to Filipe Fujiy.
  2. Now detects name clashes with C# keywords.
  3. Added "System." to DateTime.Now(), etc to prevent clashes with table field names.
  4. "Configuration" class names are now configurable as "Mapping", "Map", etc.
  5. Added support for Spatial.DbGeometry and Spatial.DbGeography. Thanks to Simply Foolish andJorge Bustos.
  6. Can now have custom collection type for Navigation Properties. "ObservableCollection" for example. Thanks to Simply Foolish.

Whats new in v2.0:

  1. Fixed issue when running 'Transform All T4 Templates' from Visual Studio Build Menu.Thanks to JRoselle.
  2. Changing mappings during runtime is not possible/expensive. A specific DbModelBuilder can be used for each needed database schema.Thanks to meixger.
  3. Added ability to detect and use .IsRowVersion().
  4. 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:

  1. VARBINARY(MAX) is now correctly assigned to byte[]. Thanks to Luke91577.
  2. Extending partial class support. Allow specification of file extension for partial classes (i.e. ".generated.cs").Thanks to AB_dreeve.
  3. Fixes issues when targeting .NET 4. .NET 4.0 doesn't include the System.ComponentModel.DataAnnotations.Schema namespace, allow specification of TargetFrameworkVersion.Thanks to AB_dreeve.

Whats new in v1.11:

  1. Including views is now working. For a view to be included, at least one column must not be nullable.Thanks to Delmo Carruzzo.
  2. Added selective generation of components (Poco, Context, UnitOfWork, PocoConfiguration). You can now build entities in your Model project, and context, configuration, unit of work in your Data project. Thanks to kscelfo.
  3. Added PrependSchemaName flag. You can now control if the schema name is prepended to the table name. Thanks to kscelfo.

Whats new in v1.10:

  1. Added UseCamelCase flag to the tt file. You can now control if you want your table and column names CamelCase or left alone: i.e. FieldPersonOrder or field_person_order

Whats new in v1.9.2:

  1. Removed the Linq de-duplication code as it is now being done in SQL. The Linq version did not include the schema name when de-duplicating FK's.

Whats new in v1.9.1:

  1. Added DISTICT to the foreign key SQL. This prevents duplicates from appearing.
    They can appear with SQL such as:
    ALTERTABLE [Mars].[Table2] WITHCHECKADDCONSTRAINT [FK_Table2_Table1]
    FOREIGNKEY([Table1Id]) REFERENCES [Mars].[Table1] ([Id]) ALTERTABLE [Mars].[Table2] CHECKCONSTRAINT [FK_Table2_Table1]

Whats new in v1.9.0:

  1. It now has the ability to read connection strings from other config files/projects.
    It starts by looking at the local project for the named connection string in the following files:
    • app.config
    • web.config
    • app.config.transform
    • web.config.transform
    • or edit the above list in the .tt and specify which file(s) to use
    If not found, it then looks for those files in all the projects within the solution.

Whats new in v1.8.0:

  1. Can now optionally generate separate files. See the new boolean flag GenerateSeparateFiles.
  2. Removed the hard coded 300 second timeout. The timeout can be specified in the connection string.

Whats new in v1.7.1:

  1. Add support for DateTime2
  2. Add support for UnitOfWork and the repository pattern. This means you can now unit test your repositories. See the source code for examples.
  3. Add IDisposable to db context.

Whats new in v1.7.0:

  1. Add .HasPrecision(precision, scale) for fields that have scale. Thanks to @choudeshell

Whats new in v1.6.0:

  1. Enhance ReadSchema performance with early table exclusion.
  2. Now supports columns with symbols and punctuation.
  3. Handles decimal default values.

Whats new in v1.5.1:

  1. A bugfix for WCF. See issue https://efreversepoco.codeplex.com/workitem/4

Whats new in v1.5.0:

  1. Ability to add WCF(DataMember, DataContract attributes) support on Entity. Requested by spatemp

Whats new in v1.4.1:

  1. Foreign keys are only included if they point to a primary key.

Whats new in v1.4.0:

  1. If a field has a default contrainst of GetDate(), add DateTime.Now() in the ctor for the field.
  2. Add support for the datetimeoffset type, including support for the default constraint sysdatetimeoffset().
  3. Add Resharper naming comments.
  4. Mappings should be marked internal. Requested by Hobbes Pirakitti

Released: v2.17.2 (Jan 25, 2016)

$
0
0
Whats new in v2.17.2:
  • Regex schema filtering.
  • Case 166. Remove "Elements.StoredProcedures" causes build errors. Thanks to bbieb.
  • Support HierarchyId.
  • Prevent the use of tables which contain periods '.' as these are invalid within entity framework.
  • Case 167. Fix ColumnFilter fully qualified name check is schema.table.columnName. Thanks to AndyGJP.

Created Release: v2.17.2 (Jan 25, 2016)

$
0
0
Whats new in v2.17.2:
  • Regex schema filtering.
  • Case 166. Remove "Elements.StoredProcedures" causes build errors. Thanks to bbieb.
  • Support HierarchyId.
  • Prevent the use of tables which contain periods '.' as these are invalid within entity framework.
  • Case 167. Fix ColumnFilter fully qualified name check is schema.table.columnName. Thanks to AndyGJP.

Closed Feature: Provide a schema filter to in/exclude tables [47]

$
0
0
Allow the user to filter tables with a Regex according to the schema the table belongs to. For instance include all tables in schema dbo, similar like the filter for tablenames.
Comments: Released in v2.17.2

Closed Issue: Column filter doesn't exclude full column names as I expect [167]

$
0
0
Hi,

I have a column called DateCreated in a table called Products.SupplierProduct - I don't want this attribute to show up in the POCO.

When I set the column filter to:

ColumnFilterExclude = new Regex("^Products.SupplierProduct.DateCreated$");

It still adds the column. But when I place the schema after the table name, like so:

ColumnFilterExclude = new Regex("^SupplierProduct.Products.DateCreated$");

It works.

Shouldn't it be [schema_name].[table_name].[column_name]?
Comments: Released in v2.17.2

Closed Issue: remove "Elements.StoredProcedures" causes build errors [166]

$
0
0
If you remove "Elements.StoredProcedures" from "ElementsToGenerate = Elements.Poco | Elements.Context | Elements.UnitOfWork | Elements.PocoConfiguration | Elements.StoredProcedures;", the following using statements are removed from the generated file: using System.Data.SqlClient;
using System.Data.SqlTypes;. But there are still functions that reference them in the generated file. Either you have to manually add them back in or leave "Elements.StoredProcedures" in the ElementsToGenerate.
Comments: Released in v2.17.2

Updated Wiki: What's new

$
0
0

Whats coming in the next major release:

  1. Data Annotations.

Whats new in v2.17.2:

  1. Regex schema filtering.
  2. Case 166. Remove "Elements.StoredProcedures" causes build errors. Thanks to bbieb.
  3. Support for HierarchyId.
  4. Prevent the use of tables which contain periods '.' as these are invalid within entity framework.
  5. Case 167. Fix ColumnFilter fully qualified name check is schema.table.columnName. Thanks toAndyGJP.

Whats new in v2.17.1:

  1. Case 162. Still using Async if TargetFrameworkVersion = "4.0". Thanks to cowpy520.
  2. Case 163. Handle views and table names with periods. Thanks to flodpanter.
  3. Changed NotNullable to be List<string> and include object. Thanks to philboyd.
  4. Include System.Collections.Generic if generating stored procedures.
  5. Finally sorted out Stored Procedure generation. You can now split out the interface/context/poco's with included stored procedures.
    For example, if you had 4 separate projects (extreme example) you can generate these with:
    • Configuration project: ElementsToGenerate = Elements.PocoConfiguration;
    • Context project: ElementsToGenerate = Elements.Context | Elements.StoredProcedures;
    • Entities project: ElementsToGenerate = Elements.Poco | Elements.StoredProcedures;
    • Interface project: ElementsToGenerate = Elements.UnitOfWork | Elements.StoredProcedures;

Whats new in v2.17.0:

  1. Case 156. Should get null instead of "NULL" for varchar DEFAULT NULL. Thanks toyyjdelete.
  2. Case 147: Add support for stored procedure user defined types. Thanks to mhwlng and Mathias.
  3. Add Find and FindAsync methods to FakeDbSet. Thanks to SoichiSaito.
  4. Changed the default for the IncludeExtendedPropertyComments to be InSummaryBlock so that if extended properties are present in the database, they provide intellisense for you.

Whats new in v2.16.1:

  1. Allow ColumnFilterExclude to target a specific Table.Schema.Column by including escaped dots in regex:
    "^Table\.dbo\.column$". Thanks to Paul Lively.
  2. Added support for EF6 Migration ContextKey. Thanks to ac_4.
  3. Case 154. Add precision and scale when using numeric parameters for stored procedures. Thanks to0v3rCl0ck.
  4. Case 148: No new line after each property "public DbSet" in DbContext. Thanks tosankan1gb.

Whats new in v2.16.0:

  1. Case 130. A new exciting feature: Support for multiple result sets returned from stored procedures.
  2. Fix bug: Stored Procedure with Nullable DateTime2 has invalid cast. Thanks toNeal Culiner.
  3. Mapping tables cannot include spaces in their name, so make them a regular table. Thanks toAndrey Stepanov Pro-Log.
  4. Made it possible to create a many-to-many relationship with the same table on each side. Thanks to Jon Califf.
  5. Case 151. ZapPassword doesn't replace passwords that don't have a trailing semicolon. Thanks toBrad Westness.
  6. Do not include excluded columns in POCO constructor. Thanks to Bacchus.
  7. Case 127. Fix bug where @ was removed from stored proc C# reserved word parameter. Thanks topinger.
  8. Case 144. Code clean up and bug fix. Thanks to jeffinflection.
  9. Better handling for property name clashes in columns. E.g. [user_id], [UserId], [user id] would all map to UserId
  10. Implemened fake functionality for SaveChangesAsync()
  11. Case 140. Include <auto-generated /> in the generated code when outputting separate files. Thanks toNeilCross andGeoArion.
  12. Case 53. Ignore read-only columns for determining mapping tables. Thanks to rvlieshout andpaultjls.
  13. Custom data annotations for ReverseNavigationProperty and ForeignKeys. Thanks toPetrettoS
  14. Corrected indent formatting of output

Whats new in v2.15.2:

  1. Make the FakeMyDbContext partial when MakeClassesPartial = true. Thanks to Police Officer.
  2. Case 140. Include <auto-generated /> in the generated code. Thanks to NeilCross andGeoArion.
  3. Case 142. Handle composite foreign keys. Thanks to GeoArion.
  4. Case 143. Add use of [DbFunctionDetails] attribute to specify schema name for TVF functions. Thanks tooatley.

Whats new in v2.15.1:

  1. Fix bug with stored procedure nullable parameters. Thanks to DannyGB.

Whats new in v2.15.0:

  1. For NTEXT fields, use .IsMaxLength(). Thanks to lucwuyts.
  2. Pass in false for the isFake parameter to WriteStoredProcFunctionSetSqlParameters when not generating a fake. Thanks toSur1969333.
  3. Ignore defaults we cannot interpret, such as "CREATE DEFAULT ..." (we would need SQL to C# compiler). Thanks tobooler.
  4. Case 133. Use full path for System.Threading.Tasks.Task to avoid clashes with table name 'Task'. Thanks toDominikDito.
  5. Case 89. Use DbSet instead of IDbSet. Thanks to 0v3rCl0ck.

Whats new in v2.14.3:

  1. Pluralize / Singularize just the last word if separated by underscore (schema_table) . Thanks toPetrettoS.
  2. Case 129. The Copyright use Western European Encoding for non-ascii char '©', and can not be recognized on other Encoding. I changed the copyright symbol to plain text. Thanks toyyjdelete.
    Copyright symbol
  3. Include schema name for enum definitions. Thanks to TheEdge3.
  4. Include .HasColumnType("sql type") in the configuration mappings. Thanks to lucwuyts.
  5. Added a parameterless constructor for the EntityTypeConfiguration classes. This is useful when you use your own context and use something likemodelBuilder.Configurations.AddFromAssembly(Assembly.GetExecutingAssembly()); when creating the model. Thanks tolucwuyts.
  6. If MakeClassesPartial=true, include a ctor even if there is no ICollection to initialise, so the call is made to InitializePartial();. Thanks tolucwuyts.

Whats new in v2.14.2:

  1. Case 128. Fixed Many-to-Many mapping for tables in different schemas. Thanks tocjmorelock.
  2. Include System.Data.SqlTypes if generating stored procedures as it's required for the INullable interface.

Whats new in v2.14.1:

  1. Handle stored procedure DBNull parameters. Thanks to rorourke.
  2. Handle stored procedure DBNull return values.
  3. Remove property restriction for HasDatabaseGeneratedOption. Thanks to fjrodriguez.

Whats new in v2.14.0:

  1. Handle a string default using the SPACE() keyword. Thanks to BBauer42.
  2. Case 125. Enable Computed Columns for type bool. Thanks to d1ner.
  3. Override Stored Procedure Return Types. Thanks to Leonard Lobel.
  4. Overloaded Stored Procedure Methods without procResult Output Parameter. Thanks toLeonard Lobel.
  5. Add enum property types support for columns. Thanks to Leonard Lobel.
  6. Added support for Azure databases. If the database is Azure, then sys.extended_properties is not used.
  7. Added support for Table Valued Functions. Thanks to Leonard Lobel. See the new variableIncludeTableValuedFunctions.
    The generator now produces strongly-typed wrappers for making TVF calls. They surface very much like stored procedures in the context, but the wrapper methods are implemented quite differently.
    Like stored procs, TVFs can be parameterized and can encapsulate custom server-side logic. But TVFs are alsocomposable, while stored procs aren’t. Meaning a LINQ query against a stored proc executes the where clause of the LINQ query on the client, whereas a LINQ query against a TVF translates the where clause of the LINQ query into a WHERE clause in T-SQL to run on the server.
    If the stored proc has a WHERE clause, then that will be executed on the server, but will then get filtered down further on the client, meaning that unneeded data was returned from the server. If the TVF has a WHERE clause, then that will also be executed on the server, but it will then get filtered down even further on the server with an “outer” WHERE clause generated by EF, meaning that no unneeded data gets returned from the server.
    If you want to use this new feature, you must also install the EntityFramework.CodeFirstStoreFunctions Nuget Package created byPawel Kadluczka (moozzyk) ex-EF team at Microsoft. Source code and documentation is herecodefirstfunctions.codeplex.com.
  8. Handle table names with underscores - singularise just the last word. i.e. Handle table names such as "IMPORTANT_THINGS" and just singuarlise the last 'word' to "ImportantThing". Thanks toDavid Gardiner.
  9. Added full namespace to database static initializer line to prevent some users experiencing compiler errors. Thanks toPaul McIlreavy.

Whats new in v2.13.1:

  1. Case 122. Bug Fix. Make use of the PrimaryKeyOrdinal for sorting when generating primary keys. Thanks tosamiljan.
  2. Fixed bug. In cases where a column had multiple foreign keys, only one foreign key was used. Thanks toChristopher Stamm.

Whats new in v2.13.0:

  1. { get; internal set; } for stored generated fields has been changed to { get; set; }. In some situations you may want to assign it manually, and another when serializing across a WCF service. The ID is lost when serializing because it was marked internal. Thanks to fjrodriguez.
  2. Bug fix: Exception was thrown when culture specific decimal separator was not '.'. Thanks toAndrew A. Evdokimov.
  3. Added the ability to specify base interfaces for the database context interface. See DbContextInterfaceBaseClasses. Thanks toDannyGB.
  4. Check for not nullable stored procedure parameters, such as string and byte[].

Whats new in v2.12.3:

  1. Remove use of [GeneratedCodeAttribute] where not necessary.
  2. Case 108. Include the schema when calling stored procedures. Thanks to emdadgar2.
  3. Case 109. Nullable uniqueidentifier with default value generates exception. Thanks tomarkuspeter.
  4. Case 107. Stored procedure return column name tidy up could bring all Null value. Thanks todisanxian.
  5. Case 106. Add support for async methods. Thanks to youngcm2.
  6. Changed the stored procedure parameters to be nullable. Thanks to Suraj Ramalingam.
  7. Case 110. Do not remove stored procedure where it has no return fields. Thanks toemdadgar2.

Whats new in v2.12.1:

  1. Case 101. SQL Server compact connection string only looks in current project. It now looks in all project paths for the SDF file, in a similar way to finding the app.config file for the connection string.
  2. Much faster TableSQL. Query plan cost is 97% vs 3%. Thanks to Glenn Orr.
  3. Much faster ForeignKeySQL. Query plan cost is 71% vs 29%.
  4. Unique indexes are now checked for. Previously, for tables without primary keys, all the NOT NULL columns used to be marked as a primary key. Now, if the table has a unique index, these unique index columns are used instead. However, the columns are still checked for being NOT NULL as entity framework will not allow a primary key to be made up of a column which can be NULLable.
  5. MakeClassesPartial flag now adds partial keyword to the stored procedure model classes.
  6. Added AdditionalContextInterfaceItems array to allow adding of extra functions to the db context interface.
  7. Fix schema prepending for Stored Procedures. Thanks to Emanov.
  8. Fix bug in MigrationStrategy when set to CreateDatabaseIfNotExists or DropCreateDatabaseIfModelChanges. Thanks toWill.
  9. Case 102. Stored procedures with no input parameters and all columns are nullable views cannot get populated in .cs. Thanks todisanxian.
  10. Calls to stored procedures are now placed in [square brackets] in case there are spaces in its name.
  11. Case 103. Check for column name C# reserved word name clashes. Thanks to swago.
  12. Do not include foreign keys which use composite keys.

Whats new in v2.11.0:

  1. Case 61. Allow excluding/modifying columns. Also permits you to run a function against each column to optionally modify the column properties (eg. to tweak the name of the generated property etc). Thanks toDavid Gardiner.
  2. Case 99. Add ability to specify additional using namespaces. Thanks to rorourke.
  3. Case 100. Apply GeneratedCodeAttribute to generated code. Thanks to David Gardiner.

Whats new in v2.10.2:

  1. Case 93. Merge logic for foreignKey column matching, previously .col=null was possible. Thanks toAHewgill.
  2. StoredProcs that return nullable binary types generate invalid "ReturnModel" code. Thanks toWallyHDisplayName.
  3. Case 96. Add a default for getutcdate(). Thanks to mbargar13.
  4. Case 94. Missing "using DatabaseGeneratedOption = System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption;" when targeting Framework 4.5. Thanks toalexdeblasis.
  5. StoredProcedureRename was being ignored. Thanks to slyCzar.
  6. Case 98. Corrected bridge table issue. Thanks to simooo985.

Whats new in v2.10.1:

  1. Stored Procedure arguments that are C# reserved keywords need escaping. Thanks toJimstr.
  2. Make mapping variables consistent during name clashes. An an edge case could cause different names for the reverse navigation as compared to the Map during name clashes. Thanks toFJRodriguez.
  3. Fix indentation when MakeClassesPartial is set.

Whats new in v2.10.0:

  1. Auto Migrations. To enable set MigrationConfigurationFileName to a class name, "MyDbContextDBMigrationConfiguration" for example. This enabled Entity Framework to update the schema when it is deployed in production. Thanks toFJRodriguez.
  2. Remove use of uses_native_compilation column in Stored Procedure SQL to support older database (< 2014). Thanks toNicholas Head.

Whats new in v2.9.1:

  1. GetSqlDbType was missing some types (nvarchar, and uniqueidentifier). Thanks toWally.
  2. Add in "using System.Linq" if Elements.StoredProcedures declared and not Elements.Context. Thanks toWally.

Whats new in v2.9.0:

  1. Stored procedure support !
    • This includes the ability to retrieve the RESULT from stored procs, as well as the data. A result of 0 means success, any other value is an error.
    • Include stubs for the stored procs in the FakeDbContext.
  2. Sort contents of HasForeignKey(...) by foreign key ordinal.
  3. Prevent creating maps where the left and right side of the map are the same table.
  4. Use a try/catch for WCF projects. Thanks to FJRodriguez.
  5. Include examples of CustomPluralizationEntry. Thanks to Carrie Kroutil.
  6. Allow for manual setting of the targeted .Net framework version.

Whats new in v2.8.3:

  1. Added new setting IncludeQueryTraceOn9481Flag so that you are now in control if "OPTION (QUERYTRACEON 9481)" is appended to the SQL. SqlServer 2014 is known to appear frozen / take a long time when this file is saved. If it does, set this to true (however you will also need elevated privileges).
  2. Added new setting DbContextBaseClass. You can now specify what the base class for your DbContext class is. For example ASP.NET Identity use "IdentityDbContext<ApplicationUser>", or even go so far as a custom: IdentityDbContext<CustomUser, CustomRole, int, CustomUserLogin, CustomUserRole, CustomUserClaim>. Thanks toParag Shravagi.
  3. Fixed bug: IndexOutOfRangeException thrown inside GetCurrentProject. Thanks toDavid Gardiner.
    https://efreversepoco.codeplex.com/workitem/85

Whats new in v2.8.2:

  1. This update is required to fix a problem with Sql Server 2014 as it freezes when obtaining the Foreign Keys. See here for more info. The solution was to add OPTION (QUERYTRACEON 9481). Thanks to@ErikEJ for the solution.
    Using this option flag needs a higher SQL privilege, so you may experience:
    User 'Your.Name' does not have permission to run DBCC TRACEON.
    More info (requires sysadmin rights) http://spaghettidba.com/2013/02/08/using-querytraceon-in-plan-guides/ 

Whats new in v2.8.1:

  1. Bug fix: If property had _ appended, and is used as key, it breaks template generation. Thanks toNicholas Head.

Whats new in v2.8.0:

  1. Added a new flag: AddUnitTestingDbContext. If true, this will create a Fake DbContext and a FakeDbSet<T>. This will allow easy unit testing. Can't believe I never added this sooner. See the documentation Unit Testing.

Whats new in v2.7.0:

  1. Fixed bug: Missing schema specification in ManyToMany tables. Thanks to Vtanman & Snajahi.
  2. Add a timeout when obtaining the schema info from a slow database. Thanks to DotNetWise.
  3. Changed table renaming to use a function. Thanks to DotNetWise.

Whats new in v2.6.3:

  1. Add IsUnicode(false) for the char/varchar columns. Thanks to Naomi N.
  2. Rollback a feature added in 2.5.1: For database types such as Numeric(17,0), the C# type should resolve to something in the "int" family. Thanks toSimmered.

Whats new in v2.6.2:

  1. Include another namespace if Target framework is not 4.0. Thanks to NazmulRockOn.
  2. CR/LF in extended properties caused errors. Thanks to Simmered.
  3. Use IsFixedLength() for char/nchar types. Thanks to Naomi N.

Whats new in v2.6.1:

  1. Added the same extended properties comments facility for SQL CE. Thanks to @ErikEJ

Whats new in v2.6.0:

  1. It now reads the extended properties and can add them to the poco classes in comments. See the new IncludeExtendedPropertyComments flag which is an enumeration of
[Flags]
public enum ExtendedPropertyCommentsStyle
{
  None,
  InSummaryBlock,
  AtEndOfField
};
  • ExtendedPropertyCommentsStyle.None: No extended properties are shown.
  • ExtendedPropertyCommentsStyle.InSummaryBlock: extended properties are shown above field in a ///<summary> block.
  • ExtendedPropertyCommentsStyle.AtEndOfField: extended properties are shown at the end of the field in a comment block.

The IncludeComments flag is completely independent to IncludeExtendedPropertyComments.

If you want completely comment free generate code, set IncludeComments = false, and IncludeExtendedPropertyComments = ExtendedPropertyCommentsStyle.None;

Whats new in v2.5.1:

  1. Move the call to tables.SetPrimaryKeys(); higher up. This allows support of tables with no primary keys to be able to be used. Thanks toJaved.
  2. For database types such as Numeric(17,0), the C# type should resolve to something in the "int" family. Thanks tosimmered.

Whats new in v2.5.0:

  1. Added option to strip and alter table names. Such as tblOrders to Orders, AB_Shipments to Shipments, etc. See Table renaming section.
  2. Added ability to switch off the Pluralization service.
  3. Added ability to use other Pluralization services, such as the SpanishPluralizationService as provided in the "EF6.Contrib" Nuget Package. If you are to use the SpanishPluralizationService, add the following to the top of your database.tt file: <#@ assembly name="C:\<Your path here>\packages\EF6.Contrib.1.0.5\lib\net45\EntityFramework.Contrib.dll" #> Changing the path to where your DLL is situated.

Whats new in v2.4.1:

  1.  Fixed bug: When using .HasForeignKey(...) for multi-column keys, the columns should be listed in ordinal order. Thanks toScott Hodges.

Whats new in v2.4.0

  1. Removed use of System.Data.Entity.DLL from the installation template as it is no longer required for EF 6.
  2. Moved spatial types from System.Data.Spatial to System.Data.Entity.Spatial for EF 6.
  3. Singular names and camel casing configuration were accidentally combined by using the UseCamelCase boolean. Thanks toRune Gulbrandsen.
  4. Added new flag IncludeComments. This controls the generation of comments in the output.
  5. Fixed bug in constructor where a UNIQUEIDENTIFIER column had default value. Thanks togonglei.

Whats new in v2.3.2

  1. Singularize one-to-one Reverse Navigation. Thanks to StormRider.
  2. Bugfix for IsRowVersion() for timestamp columns. Thanks to StormRider.
  3. Do not append "m" to decimal value in poco ctor if default contains an unparsable value.

Whats new in v2.3.0:

  1. SQL Server Compact 4.0 support. Thanks to ErikEJ.

Whats new in v2.2.1:

  1. Add strings to be allowed as computed columns. Thanks to JBJBJB and BrhineScot.
  2. Now includes callbacks during code generation. This means you can add attributes to classes, specify a base class, specify custom code within the class, and finally a call back for each column within the class. Thanks toSimplyFoolish
  3. OData doesn't support entities with geometery/geography types. Provided a flag to turn these off if entities are being generated from ODATA.  Thanks toSimplyFoolish. Flag is called DisableGeographyTypes.
  4. Fixed bug with the Pluralisation service. If your current culture was not en, then it would throw an exception. Thanks toErikEJ.

Whats new in v2.2.0:

  1. Now uses the .Net Pluralization service. Thanks to James Manning.
  2. Bug fixed when you have foreign keys between two tables where the FK/PK columns have spaces in the column name. Thanks toColin Smith.
  3. Bug fixed. Solution Folders are not searched for config settings. Thanks to scaftw.
  4. Generate navigation property based on FK name. If there are two FK links to a table, the second link would appear as linkName1. This is now detected and both the FK properties will make use of the FK name. If only one FK is used, then the FK name is not appended to the table name. Thanks to saber_solomon.
  5. Sort the generated Reverse navigation and foriegn keys in POCO classes.

Whats new in v2.1.0:

  1. Fixed bug if default constraint was not in expected format. Thanks to Filipe Fujiy.
  2. Now detects name clashes with C# keywords.
  3. Added "System." to DateTime.Now(), etc to prevent clashes with table field names.
  4. "Configuration" class names are now configurable as "Mapping", "Map", etc.
  5. Added support for Spatial.DbGeometry and Spatial.DbGeography. Thanks to Simply Foolish andJorge Bustos.
  6. Can now have custom collection type for Navigation Properties. "ObservableCollection" for example. Thanks to Simply Foolish.

Whats new in v2.0:

  1. Fixed issue when running 'Transform All T4 Templates' from Visual Studio Build Menu.Thanks to JRoselle.
  2. Changing mappings during runtime is not possible/expensive. A specific DbModelBuilder can be used for each needed database schema.Thanks to meixger.
  3. Added ability to detect and use .IsRowVersion().
  4. 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:

  1. VARBINARY(MAX) is now correctly assigned to byte[]. Thanks to Luke91577.
  2. Extending partial class support. Allow specification of file extension for partial classes (i.e. ".generated.cs").Thanks to AB_dreeve.
  3. Fixes issues when targeting .NET 4. .NET 4.0 doesn't include the System.ComponentModel.DataAnnotations.Schema namespace, allow specification of TargetFrameworkVersion.Thanks to AB_dreeve.

Whats new in v1.11:

  1. Including views is now working. For a view to be included, at least one column must not be nullable.Thanks to Delmo Carruzzo.
  2. Added selective generation of components (Poco, Context, UnitOfWork, PocoConfiguration). You can now build entities in your Model project, and context, configuration, unit of work in your Data project. Thanks to kscelfo.
  3. Added PrependSchemaName flag. You can now control if the schema name is prepended to the table name. Thanks to kscelfo.

Whats new in v1.10:

  1. Added UseCamelCase flag to the tt file. You can now control if you want your table and column names CamelCase or left alone: i.e. FieldPersonOrder or field_person_order

Whats new in v1.9.2:

  1. Removed the Linq de-duplication code as it is now being done in SQL. The Linq version did not include the schema name when de-duplicating FK's.

Whats new in v1.9.1:

  1. Added DISTICT to the foreign key SQL. This prevents duplicates from appearing.
    They can appear with SQL such as:
    ALTERTABLE [Mars].[Table2] WITHCHECKADDCONSTRAINT [FK_Table2_Table1]
    FOREIGNKEY([Table1Id]) REFERENCES [Mars].[Table1] ([Id]) ALTERTABLE [Mars].[Table2] CHECKCONSTRAINT [FK_Table2_Table1]

Whats new in v1.9.0:

  1. It now has the ability to read connection strings from other config files/projects.
    It starts by looking at the local project for the named connection string in the following files:
    • app.config
    • web.config
    • app.config.transform
    • web.config.transform
    • or edit the above list in the .tt and specify which file(s) to use
    If not found, it then looks for those files in all the projects within the solution.

Whats new in v1.8.0:

  1. Can now optionally generate separate files. See the new boolean flag GenerateSeparateFiles.
  2. Removed the hard coded 300 second timeout. The timeout can be specified in the connection string.

Whats new in v1.7.1:

  1. Add support for DateTime2
  2. Add support for UnitOfWork and the repository pattern. This means you can now unit test your repositories. See the source code for examples.
  3. Add IDisposable to db context.

Whats new in v1.7.0:

  1. Add .HasPrecision(precision, scale) for fields that have scale. Thanks to @choudeshell

Whats new in v1.6.0:

  1. Enhance ReadSchema performance with early table exclusion.
  2. Now supports columns with symbols and punctuation.
  3. Handles decimal default values.

Whats new in v1.5.1:

  1. A bugfix for WCF. See issue https://efreversepoco.codeplex.com/workitem/4

Whats new in v1.5.0:

  1. Ability to add WCF(DataMember, DataContract attributes) support on Entity. Requested by spatemp

Whats new in v1.4.1:

  1. Foreign keys are only included if they point to a primary key.

Whats new in v1.4.0:

  1. If a field has a default contrainst of GetDate(), add DateTime.Now() in the ctor for the field.
  2. Add support for the datetimeoffset type, including support for the default constraint sysdatetimeoffset().
  3. Add Resharper naming comments.
  4. Mappings should be marked internal. Requested by Hobbes Pirakitti

Source code checked in, #7ae2debbc343

Viewing all 1642 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>