Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Related entities as dto object #8

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Add ToListDTO
  • Loading branch information
Gwenou committed Apr 13, 2017
commit 281fb1bba3d2fddbc9d202bdf9de5e4115072dfa
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ public static TDto ToDTO<TEntity, TDto>(this TEntity entity,Expression<Func<TEnt
return (new List<TEntity>() { entity }).AsQueryable().Select(expression).SingleOrDefault();
}

public static IQueryable<TDto> ToListDTO<TEntity, TDto>(this IQueryable<TEntity> entities,
Expression<Func<TEntity, TDto>> expression)
{
return entities.Select(expression);
}

class ParameterReplaceVisitor : ExpressionVisitor
{
private readonly ParameterExpression from, to;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="DtoGenerator.Vsix.Ivan Cesar.fc3ee012-1f8f-496f-933e-08139824c3be" Version="1.8.4" Language="en-US" Publisher="Ivan Cesar" />
<Identity Id="DtoGenerator.Vsix.Ivan Cesar.fc3ee012-1f8f-496f-933e-08139824c3be" Version="1.8.5" Language="en-US" Publisher="Ivan Cesar" />
<DisplayName>DTO Generator</DisplayName>
<Description xml:space="preserve">This simple tool uses Roslyn API to find out about the code, and reads entity properties and generates corresponding DTO object, with mapper class attached.</Description>
<MoreInfo>https://github.com/yohney/dto-generator</MoreInfo>
Expand Down