If you could please look at the method I am trying to write below. Is there someway I can replace the "l.DeploymentId" part with something I could pass in as an argument to the method? Like and expression<func>...? Anything?
IQueryable<TEntity> SecureList<TEntity>(IServiceQuery query, IQueryable<TEntity> list, LinqMetaData meta, string entityType) where TEntity : SD.LLBLGen.Pro.ORMSupportClasses.IEntity2
{
if (!string.IsNullOrEmpty(query.RequiredPermission))
{
if (!UserId.HasValue)
return Enumerable.Empty<TEntity>().AsQueryable();
list = from l in list
join c in meta.EntityRole on new { EntityId = l.DeploymentId, EntityType = entityType, UserId = UserId.Value } equals new { c.EntityId, c.EntityType, c.UserId }
join rp in meta.RolePermission on c.RoleId equals rp.RoleId
join p in meta.Permission on rp.PermissionId equals p.PermissionId
where p.Name == query.RequiredPermission
select l;
}
}