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

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.

Viewing all articles
Browse latest Browse all 1642

Latest Images

Trending Articles



Latest Images

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