Пример #1
0
 /// <summary>
 /// Create an instance with a new copy of the state
 /// </summary>
 /// <param name="modelBag"></param>
 public ModelBag(ModelBag modelBag)
 {
     _modelMap = new ConcurrentDictionary <int, IContainerModel>(modelBag._modelMap);
 }
Пример #2
0
 /// <summary>
 /// Dispose of the Model bag.
 /// </summary>
 public void Dispose()
 {
     ModelBag?.Dispose();
 }
Пример #3
0
 /// <summary>
 /// Create an instance of the build owner
 /// </summary>
 /// <param name="cloneMode">They way in which models of stateful containers are stored.</param>
 /// <param name="swallowCloneErrors">Whether we should ignore cloning of model errors</param>
 /// <remarks>Currently clone mode is only used for indication as to whether to clone at all or not.
 /// </remarks>
 public BuildOwner(CloneMode cloneMode = CloneMode.Deep, bool swallowCloneErrors = true)
 {
     _cloneMode          = cloneMode;
     _swallowCloneErrors = swallowCloneErrors;
     ModelBag            = new ModelBag();
 }
Пример #4
0
 /// <summary>
 /// Get the current model for a specified stateful container.
 /// </summary>
 /// <typeparam name="TModel"></typeparam>
 /// <param name="component"></param>
 /// <returns></returns>
 public TModel GetModel <TModel>(IStatefulContainer <TModel> component)
 {
     return(ModelBag.Get(component));
 }