Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Last active November 30, 2015 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/8b4f82dc7bafca780c15 to your computer and use it in GitHub Desktop.
Save justinyoo/8b4f82dc7bafca780c15 to your computer and use it in GitHub Desktop.
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