Store Class

 

The store contains an in-memory representation of the elements and links in one or more models.

Namespace:   Microsoft.VisualStudio.Modeling
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.12.0 (in Microsoft.VisualStudio.Modeling.Sdk.12.0.dll)

System.Object
  Microsoft.VisualStudio.Modeling.Store

public class Store : IServiceProvider, IDisposable

NameDescription
System_CAPS_pubmethodStore(IServiceProvider, Dictionary<Object, Object>, Type[])

Creates an instance of the Store class which delegates IServiceProvider implementation to the given serviceProvider.

System_CAPS_pubmethodStore(IServiceProvider, Type[])

Initializes a new instance of the Store class.

System_CAPS_pubmethodStore(Type[])

Initializes a new instance of the Store class.

NameDescription
System_CAPS_pubpropertyChangeSource

Gets the current change source for operations in the store.

System_CAPS_pubpropertyCurrentContext

Gets the current context of the store.

System_CAPS_pubpropertyDefaultPartition

Gets or sets the default partition for the store.

System_CAPS_pubpropertyDemandLoading

Gets whether the store is currently demand loading a relationship.

System_CAPS_pubpropertyDisposed

Gets whether the store has been disposed.

System_CAPS_pubpropertyDomainDataDirectory

Gets domain information directory of the store.

System_CAPS_pubpropertyDomainModels

Gets a collection of domain models in this store.

System_CAPS_pubpropertyElementDirectory

Gets the directory of elements contained within the store.

System_CAPS_pubpropertyElementFactory

Gets the element factory for the model.

System_CAPS_pubpropertyEventManagerDirectory

Gets the event manager directory for the model.

System_CAPS_pubpropertyId

Gets the ID of the store.

System_CAPS_pubpropertyInRedo

Gets the store and verifies whether the current context of the store is being redone.

System_CAPS_pubpropertyInSerializationTransaction

Indicates that the store has a currently active serialization transaction in the transaction stack

System_CAPS_pubpropertyInUndo

Gets the store and verifies whether the current context of the store is being undone.

System_CAPS_pubpropertyInUndoRedoOrRollback

Gets the store and verifies whether the current context of the store is being redone, undone, or rolled back.

System_CAPS_pubpropertyPartitions

Gets the Collection of Partition objects for the store.

System_CAPS_pubpropertyPartitionsAlternate

Gets the partitions used in the store.

System_CAPS_pubpropertyPropertyBag

Gets the property bag for the store.

System_CAPS_pubpropertyRuleManager

Gets the rule manager for the store.

System_CAPS_pubpropertySerializerDirectory

The default serialization directory for this store

System_CAPS_pubpropertyShuttingDown

Gets the store and verifies whether the store is shutting down, or sets the state of the store as shutting down.

System_CAPS_pubpropertyTransactionActive

Gets or sets whether the store has a currently active transaction.

System_CAPS_pubpropertyTransactionLogs

Gets the current list of transaction logs for the store.

System_CAPS_pubpropertyTransactionManager

Gets the transaction manager for the model.

System_CAPS_pubpropertyUndoManager

Gets the UndoManager for the default context.

System_CAPS_pubpropertyVersion

Gets the version of the store.

NameDescription
System_CAPS_pubmethodAddMonikerResolver(Guid, IMonikerResolver)

Register an IMonikerResolver for the specified domain model.

System_CAPS_pubmethodDefaultPartitionForClass(Guid)

Return the partition into which new elements of the specified class should be created by default.

System_CAPS_pubmethodDispose()

Disposes the store.

System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodFindDomainModel(Guid)

Finds a domain model by its ID.

System_CAPS_pubmethodFindMonikerResolver(Guid)

Finds the IMonikerResolver registered for the specified domain model.

System_CAPS_pubmethodGetClosurePrototypeGroup(ICollection<ModelElement>, ClosureType)

Creates an element group prototype in the default partition of the given closure type if a list of root elements is specified.

System_CAPS_pubmethodGetClosurePrototypeGroup(ICollection<ModelElement>, ClosureType, Boolean)

Creates an element group prototype in the default partition of the specified closure type when given a list of root elements and allows bypassing of demand loading.

System_CAPS_pubmethodGetDomainModel(Guid)

Gets an instance of a domain model by its ID.

System_CAPS_pubmethodGetDomainModel<T>()

Gets an instance of a specified domain model type.

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetService(Type)

Gets a service.

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodLoadDomainModels(Type[])

Creates all the domain data for the specified list of domain models.

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodPopContext()

Removes the current context off the top of the stack.

System_CAPS_pubmethodPushContext(Context)

Pushes a new context to the top of the store context stack.

System_CAPS_pubmethodRegisterTransactionLog(TransactionLog)

Allows a client to register a transaction log that will be notified of events on this store.

System_CAPS_pubmethodToString()

(Inherited from Object.)

System_CAPS_pubmethodUnregisterTransactionLog(TransactionLog)

Allows a client to unregister a transaction log from being notified of events on this store.

NameDescription
System_CAPS_pubeventStoreDisposing

Occurs when the store is disposing.

NameDescription
System_CAPS_pubmethodGetLocks()

Overloaded. Get the lock flags for this Store instance(Defined by ImmutabilityExtensionMethods.)

System_CAPS_pubmethodIsLocked(Locks)

Overloaded. Test whether this store has any of a specified set of locks(Defined by ImmutabilityExtensionMethods.)

System_CAPS_pubmethodSetLocks(Locks)

Overloaded. Set the lock flags of this Store instance(Defined by ImmutabilityExtensionMethods.)

The store contains information about one or more models. A store can contain a collection of models, although often there is only one model in the store.

The store also contains metadata about a model and information about the instances of the elements and links between elements that make up that model. Metadata contains the types allowed in the model and their relationships.

The store has several data structures that are filled when a model is loaded into the store. This occurs under the following circumstances:

  • when your domain-specific language is launched, either as an experimental build

  • when you have deployed your domain-specific language and an end user launches it

  • when you load a model programmatically into the store

The DomainDataDirectory contains the metadata about the types allowed to be in the model.

The ElementDirectory contains information about each element instance and their links. (The instances in the ElementDirectory must be of types defined in the DomainDataDirectory.)

From the store, you can navigate to the individual items in the store. You can get information about elements or types. You can also do the following tasks:

  • add items

  • delete items

  • modify existing elements and links and their properties

Whenever you modify a store, you must enclose any code that writes to the store in a Transaction. You can cancel all the changes to the store made in a transaction by doing a Rollback of the transaction or by not doing a Commit of the transaction.

The store has a RuleManager that contains functionality to subscribe to rules. The store can also subscribe to events.

The store also has an UndoManager which has members that allow you to undo and redo changes to the store. You generally do not have to create a new instance of a store, although you can and can read a model into it by deserializing a model into the new instance. Often, you get access to the store from the Store property of an element or link in the model. The event arguments of rules and events provide the element or link instance that the rule or event pertains to, and you can use its Store property to access the store and its TransactionManager.

The following examples show different ways to instantiate a store. When there are dependencies between domain models, as in the third example that follows, the domain models should be specified in order of dependency.

// Create a store with your domain models (classes in the generated 
// code derived from Microsoft.VisualStudio.Modeling.DomainModel).
Store store = new Store(typeof(ActivityDomainModel));

// Domain models can be loaded into the store after construction.
// Be sure to call store.Dispose() when you are done with it. 
Store store2 = new Store();
Store2.LoadDomainModels(typeof(ActivityDomainModel));

// Multiple domain models can be loaded into the store at once
Store store3 = new Store(typeof(BaseActivityDomainModel), typeof(ExtendedActivityDomainModel));

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: