Skip to content

Instantly share code, notes, and snippets.

@justinyoo justinyoo/entity-filtering-service.cs Secret
Last active Nov 30, 2015

Embed
What would you like to do?
CRM 2015 Filtering Sample
public class EntityFilteringService : ICodeWriterFilterService
{
private readonly IFilterItemCollection _collection;
public EntityFilteringService(ICodeWriterFilterService defaultService)
{
this.DefaultService = defaultService;
this._collection = FilterItemCollection.CreateInstance();
}
...
public bool GenerateEntity(EntityMetadata entityMetadata, IServiceProvider services)
{
var isValidEntity = this.IsValidEntity(entityMetadata.LogicalName);
return isValidEntity && this.DefaultService.GenerateEntity(entityMetadata, services);
}
...
private bool IsValidEntity(string entityName)
{
var isValidEntity = this._collection.IsValidEntity(entityName);
return isValidEntity;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.