Guides

EntityCollectionService

Documentation for the Merch EntityCollectionService

This service is used to manage entity collections. Both Static and Dynamic Collections are managed with the EntityCollectionService.

Instantiating

The EntityCollectionService is exposed through the MerchelloContext

var entityCollectionService = MerchelloContext.Current.Services.EntityCollectionService;

Class

public class EntityCollectionService : MerchelloRepositoryService, 
	IEntityCollectionService, IService

Constructors

NameDescription
EntityCollectionService()Initializes a new instance of the EntityCollectionService class.
EntityCollectionService(ILogger)Initializes a new instance of the EntityCollectionService class.
EntityCollectionService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger)Initializes a new instance of the EntityCollectionService class.
EntityCollectionService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory)Initializes a new instance of the EntityCollectionService class.

Public Methods

NameDescription
ChildEntityCollectionCountReturns the child collection count
CreateEntityCollection(EntityType, Guid, String, Boolean)Creates an entity collection without saving it to the database
CreateEntityCollectionWithKey(EntityType, Guid, String, Boolean)Creates an entity collection and saves it to the database
Delete(IEntityCollection, Boolean)Deletes a single entity collection.
ExistsInCollectionReturns a value indicating whether or not an entity exists in a collection
GetAllGets all collection
GetByEntityTfKeyGets collections by entity type
GetByKeyGets a collection by it's unique key
GetByProviderKeyGets collections for a given provider key
GetChildrenGets a collection's child collections
GetFromCollectionGet an entity from a collection
GetRootLevelEntityCollections()Gets the root level entity collections
GetRootLevelEntityCollections(Guid)Gets the root level entity collections for a specific entity type.
GetRootLevelEntityCollections(EntityType)Gets the root level entity collections for a specific entity type.
HasChildEntityCollectionsReturns a value indicating whether or not a collection has child collections
Save(IEntityCollection, Boolean)Saves a single entity collection.
Save(IEnumerable(IEntityCollection), Boolean)Saves a collection of entity collections.

Events

NameDescription
CreatingOccurs before create
CreatedOccurs after create
DeletingOccurs before delete
DeletedOccurs after delete
SavingOccurs before save
SavedOccurs after save

Interface on GitHub

https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/EntityCollectionService.cs