You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Id | ParentId | CompanyName | Description
ParentId referencing to Id, which creates a parent child relationship.
the generated Code is incorrect?
from T4 template ActiveRecord.tt
public IQueryable<<#=fk.OtherClass #>> <#=propName #>
{
get
{
var repo=<#=Namespace #>.<#=fk.OtherClass#>.GetRepo();
return from items in repo.GetAll()
where items.<#=CleanUp(fk.OtherColumn)#> == _<#=CleanUp(fk.ThisColumn)#>
select items;
}
}
will generate :
public IQueryable<Company> Companies
{
get
{
var repo=EMS.Data.Company.GetRepo();
return from items in repo.GetAll()
where items.Id == _ParentId
select items;
}
}
I added Checking if the table is referencing itself:
public IQueryable<<#=fk.OtherClass #>> <#=propName #>
{
get
{
var repo=<#=Namespace #>.<#=fk.OtherClass#>.GetRepo();
return from items in repo.GetAll()
<# if(fk.OtherClass != tbl.ClassName) { #>
where items.<#=CleanUp(fk.OtherColumn)#> == _<#=CleanUp(fk.ThisColumn)#>
<#}else {#>
where items.<#=CleanUp(fk.ThisColumn)#> == _<#=CleanUp(fk.OtherColumn)#>
<#}#>
select items;
}
}
which generates this code:
public IQueryable<Company> Companies
{
get
{
var repo=EMS.Data.Company.GetRepo();
return from items in repo.GetAll()
where items.ParentId == _Id
select items;
}
}
which i think is correct since Companies represent the Child company of my entity.
The text was updated successfully, but these errors were encountered:
I am using ActiveRecord
I have a company table with fields:
Id | ParentId | CompanyName | Description
ParentId referencing to Id, which creates a parent child relationship.
the generated Code is incorrect?
from T4 template ActiveRecord.tt
will generate :
I added Checking if the table is referencing itself:
which generates this code:
which i think is correct since Companies represent the Child company of my entity.
The text was updated successfully, but these errors were encountered: