public static string GetInheritSnippet(RowPermissionsInheritFromInfo info, string permissionExpressionName) { return string.Format( @"{{ var parentRepository = executionContext.Repository.{0}.{1}; var parentRowPermissionsExpression = {0}._Helper.{1}_Repository.{2}(parentRepository.Query(), repository, executionContext); var replacedExpression = new ReplaceWithReference<{0}.{1}, {3}>(parentRowPermissionsExpression, ""{4}"" , ""{5}"").NewExpression; filterExpression.Include(replacedExpression); }} ", info.Source.Module, info.Source.Name, permissionExpressionName, info.RowPermissionsFilters.DataStructure.GetKeyProperties(), info.SourceSelector, info.RowPermissionsFilters.DataStructure.Name.ToLower() + "Item"); }
public static string GetInheritSnippet(RowPermissionsInheritFromInfo info, string permissionExpressionName, string sameMembersTag) { return string.Format( @"{{ var sameMembers = new Tuple<string, string>[] {{ " + sameMembersTag + @" }}; var parentRepository = executionContext.Repository.{0}.{1}; var parentRowPermissionsExpression = {0}._Helper.{1}_Repository.{2}(parentRepository.Query(), repository, executionContext); var replacedExpression = new ReplaceWithReference<Common.Queryable.{0}_{1}, Common.Queryable.{3}_{4}>(parentRowPermissionsExpression, ""{5}"" , ""{6}"", sameMembers).NewExpression; filterExpression.Include(replacedExpression); }} ", info.Source.Module, info.Source.Name, permissionExpressionName, info.RowPermissionsFilters.DataStructure.Module.Name, info.RowPermissionsFilters.DataStructure.Name, info.SourceSelector, info.RowPermissionsFilters.DataStructure.Name.ToLower() + "Item"); }