Class ModelRepository
Represents a standard model repository
Implements
Inherited Members
Namespace: NMF.Models.Repository
Assembly: NMF.Models.dll
Syntax
public class ModelRepository : IModelRepository
Constructors
| Edit this page View SourceModelRepository()
Creates a new model repository with the meta repository as parent
Declaration
public ModelRepository()
ModelRepository(IModelRepository)
Creates a new model repository with a given parent
Declaration
public ModelRepository(IModelRepository parent)
Parameters
Type | Name | Description |
---|---|---|
IModelRepository | parent | The parent repository |
Remarks
If no parent repository is provided, the meta repository is used as parent repository
ModelRepository(IModelRepository, IModelSerializer, params IModelLocator[])
Creates a new model repository with a given parent
Declaration
public ModelRepository(IModelRepository parent, IModelSerializer serializer, params IModelLocator[] locators)
Parameters
Type | Name | Description |
---|---|---|
IModelRepository | parent | The parent repository |
IModelSerializer | serializer | A serializer object or null to use the default |
IModelLocator[] | locators | A set of model locators |
Remarks
If no parent repository is provided, the meta repository is used as parent repository
Properties
| Edit this page View SourceLocators
Gets a collection of model locators
Declaration
public ICollection<IModelLocator> Locators { get; }
Property Value
Type | Description |
---|---|
ICollection<IModelLocator> |
Models
Gets a dictionary of the models loaded to this repository
Declaration
public ModelCollection Models { get; }
Property Value
Type | Description |
---|---|
ModelCollection |
Parent
Gets the parent model repository.
Declaration
public IModelRepository Parent { get; }
Property Value
Type | Description |
---|---|
IModelRepository |
Serializer
Gets or sets the serializer that is used for the deserialization of the models
Declaration
public IModelSerializer Serializer { get; set; }
Property Value
Type | Description |
---|---|
IModelSerializer |
Methods
| Edit this page View SourceOnBubbledChange(BubbledChangeEventArgs)
Declaration
protected virtual void OnBubbledChange(BubbledChangeEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
BubbledChangeEventArgs | e |
OnUnresolvedModelElement(UnresolvedModelElementEventArgs)
Gets called when a Uri cannot be resolved
Declaration
protected virtual void OnUnresolvedModelElement(UnresolvedModelElementEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
UnresolvedModelElementEventArgs | e | The event data |
Resolve(string)
Resolves the given file path for a model element
Declaration
public Model Resolve(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | The file path where to look for models |
Returns
Type | Description |
---|---|
Model | The model at this file path or null if the file cannot be found |
Resolve(Uri, bool)
Resolves the given Uri and returns the model element
Declaration
public IModelElement Resolve(Uri uri, bool loadOnDemand = true)
Parameters
Type | Name | Description |
---|---|---|
Uri | uri | The Uri where to look for the model element |
bool | loadOnDemand | A boolean flag indicating whether the uri should be attempted to load, if the model is not already registered with the repository |
Returns
Type | Description |
---|---|
IModelElement | A model element at the given Uri or null if none can be found |
Resolve(Uri, string, bool)
Resolves the given Uri and returns the model element
Declaration
public IModelElement Resolve(Uri uri, string hintPath, bool loadOnDemand = true)
Parameters
Type | Name | Description |
---|---|---|
Uri | uri | The Uri where to look for the model element |
string | hintPath | The path where the model can be found |
bool | loadOnDemand | A boolean flag indicating whether the uri should be attempted to load, if the model is not already registered with the repository |
Returns
Type | Description |
---|---|
IModelElement | A model element at the given Uri or null if none can be found |
Save(IModelElement, Stream, Uri)
Saves the given model element to the specified stream
Declaration
public void Save(IModelElement element, Stream stream, Uri uri)
Parameters
Type | Name | Description |
---|---|---|
IModelElement | element | The model element |
Stream | stream | The stream to save the model element to |
Uri | uri | The uri under which the model element shall be retrievable |
Save(IModelElement, string)
Saves the given model element to the specified stream
Declaration
public void Save(IModelElement element, string path)
Parameters
Type | Name | Description |
---|---|---|
IModelElement | element | The model element |
string | path | The path where to save the model element |
Save(IModelElement, string, Uri)
Saves the given model element to the specified stream
Declaration
public void Save(IModelElement element, string path, Uri uri)
Parameters
Type | Name | Description |
---|---|---|
IModelElement | element | The model element |
string | path | The path where to save the model element |
Uri | uri | The uri under which the model element can be retrieved |
Events
| Edit this page View SourceBubbledChange
Declaration
public event EventHandler<BubbledChangeEventArgs> BubbledChange
Event Type
Type | Description |
---|---|
EventHandler<BubbledChangeEventArgs> |
UnresolvedModelElement
Gets fired when a Uri cannot be resolved
Declaration
public event EventHandler<UnresolvedModelElementEventArgs> UnresolvedModelElement
Event Type
Type | Description |
---|---|
EventHandler<UnresolvedModelElementEventArgs> |