//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using DslModeling = global::Microsoft.VisualStudio.Modeling;
using DslDesign = global::Microsoft.VisualStudio.Modeling.Design;
namespace Company.Smpl
{
/// <summary>
/// DomainClass ExampleModel
/// The root in which all other elements are embedded. Appears as a diagram.
/// </summary>
[DslDesign::DisplayNameResource("Company.Smpl.ExampleModel.DisplayName", typeof(global::Company.Smpl.SmplDomainModel), "Company.Smpl.GeneratedCode.DomainModelResx")]
[DslDesign::DescriptionResource("Company.Smpl.ExampleModel.Description", typeof(global::Company.Smpl.SmplDomainModel), "Company.Smpl.GeneratedCode.DomainModelResx")]
[global::System.CLSCompliant(true)]
[DslModeling::DomainObjectId("7f0843fc-123a-4999-8254-bf4afb19eb0e")]
public partial class ExampleModel : DslModeling::ModelElement
{
#region Constructors, domain class Id
/// <summary>
/// ExampleModel domain class Id.
/// </summary>
public static readonly new global::System.Guid DomainClassId = new global::System.Guid(0x7f0843fc, 0x123a, 0x4999, 0x82, 0x54, 0xbf, 0x4a, 0xfb, 0x19, 0xeb, 0x0e);
/// <summary>
/// Constructor
/// </summary>
/// <param name="store">Store where new element is to be created.</param>
/// <param name="propertyAssignments">List of domain property id/value pairs to set once the element is created.</param>
public ExampleModel(DslModeling::Store store, params DslModeling::PropertyAssignment[] propertyAssignments)
: this(store != null ? store.DefaultPartition : null, propertyAssignments)
{
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="partition">Partition where new element is to be created.</param>
/// <param name="propertyAssignments">List of domain property id/value pairs to set once the element is created.</param>
public ExampleModel(DslModeling::Partition partition, params DslModeling::PropertyAssignment[] propertyAssignments)
: base(partition, propertyAssignments)
{
}
#endregion
#region Elements opposite domain role accessor
/// <summary>
/// Gets a list of Elements.
/// </summary>
public virtual DslModeling::LinkedElementCollection<ExampleElement> Elements
{
[global::System.Diagnostics.DebuggerStepThrough]
get
{
return new DslModeling::LinkedElementCollection<ExampleElement>(this, global::Company.Smpl.ExampleModelHasElements.ExampleModelDomainRoleId);
}
}
#endregion
#region ElementGroupPrototype Merge methods
/// <summary>
/// Returns a value indicating whether the source element represented by the
/// specified root ProtoElement can be added to this element.
/// </summary>
/// <param name="rootElement">
/// The root ProtoElement representing a source element. This can be null,
/// in which case the ElementGroupPrototype does not contain an ProtoElements
/// and the code should inspect the ElementGroupPrototype context information.
/// </param>
/// <param name="elementGroupPrototype">The ElementGroupPrototype that contains the root ProtoElement.</param>
/// <returns>true if the source element represented by the ProtoElement can be added to this target element.</returns>
protected override bool CanMerge(DslModeling::ProtoElementBase rootElement, DslModeling::ElementGroupPrototype elementGroupPrototype)
{
if ( elementGroupPrototype == null ) throw new global::System.ArgumentNullException("elementGroupPrototype");
if (rootElement != null)
{
DslModeling::DomainClassInfo rootElementDomainInfo = this.Partition.DomainDataDirectory.GetDomainClass(rootElement.DomainClassId);
if (rootElementDomainInfo.IsDerivedFrom(global::Company.Smpl.ExampleElement.DomainClassId))
{
return true;
}
}
return base.CanMerge(rootElement, elementGroupPrototype);
}
/// <summary>
/// Called by the Merge process to create a relationship between
/// this target element and the specified source element.
/// Typically, a parent-child relationship is established
/// between the target element (the parent) and the source element
/// (the child), but any relationship can be established.
/// </summary>
/// <param name="sourceElement">The element that is to be related to this model element.</param>
/// <param name="elementGroup">The group of source ModelElements that have been rehydrated into the target store.</param>
/// <remarks>
/// This method is overriden to create the relationship between the target element and the specified source element.
/// The base method does nothing.
/// </remarks>
protected override void MergeRelate(DslModeling::ModelElement sourceElement, DslModeling::ElementGroup elementGroup)
{
// In general, sourceElement is allowed to be null, meaning that the elementGroup must be parsed for special cases.
// However this is not supported in generated code. Use double-deriving on this class and then override MergeRelate completely if you
// need to support this case.
if ( sourceElement == null ) throw new global::System.ArgumentNullException("sourceElement");
global::Company.Smpl.ExampleElement sourceExampleElement1 = sourceElement as global::Company.Smpl.ExampleElement;
if (sourceExampleElement1 != null)
{
// Create link for path ExampleModelHasElements.Elements
this.Elements.Add(sourceExampleElement1);
return;
}
// Fall through to base class if this class hasn't handled the merge.
base.MergeRelate(sourceElement, elementGroup);
}
/// <summary>
/// Performs operation opposite to MergeRelate - i.e. disconnects a given
/// element from the current one (removes links created by MergeRelate).
/// </summary>
/// <param name="sourceElement">Element to be unmerged/disconnected.</param>
[global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
protected override void MergeDisconnect(DslModeling::ModelElement sourceElement)
{
if (sourceElement == null) throw new global::System.ArgumentNullException("sourceElement");
global::Company.Smpl.ExampleElement sourceExampleElement1 = sourceElement as global::Company.Smpl.ExampleElement;
if (sourceExampleElement1 != null)
{
// Delete link for path ExampleModelHasElements.Elements
foreach (DslModeling::ElementLink link in global::Company.Smpl.ExampleModelHasElements.GetLinks((global::Company.Smpl.ExampleModel)this, sourceExampleElement1))
{
// Delete the link, but without possible delete propagation to the element since it's moving to a new location.
link.Delete(global::Company.Smpl.ExampleModelHasElements.ExampleModelDomainRoleId, global::Company.Smpl.ExampleModelHasElements.ElementDomainRoleId);
}
return;
}
// Fall through to base class if this class hasn't handled the unmerge.
base.MergeDisconnect(sourceElement);
}
#endregion
}
}
namespace Company.Smpl
{
/// <summary>
/// DomainClass ExampleElement
/// Elements embedded in the model. Appear as boxes on the diagram.
/// </summary>
[DslDesign::DisplayNameResource("Company.Smpl.ExampleElement.DisplayName", typeof(global::Company.Smpl.SmplDomainModel), "Company.Smpl.GeneratedCode.DomainModelResx")]
[DslDesign::DescriptionResource("Company.Smpl.ExampleElement.Description", typeof(global::Company.Smpl.SmplDomainModel), "Company.Smpl.GeneratedCode.DomainModelResx")]
[global::System.CLSCompliant(true)]
[global::System.Diagnostics.DebuggerDisplay("{GetType().Name,nq} (Name = {namePropertyStorage})")]
[DslModeling::DomainObjectId("6447df98-c203-42d1-a097-2c56b34ebc27")]
public partial class ExampleElement : DslModeling::ModelElement
{
#region Constructors, domain class Id
/// <summary>
/// ExampleElement domain class Id.
/// </summary>
public static readonly new global::System.Guid DomainClassId = new global::System.Guid(0x6447df98, 0xc203, 0x42d1, 0xa0, 0x97, 0x2c, 0x56, 0xb3, 0x4e, 0xbc, 0x27);
/// <summary>
/// Constructor
/// </summary>
/// <param name="store">Store where new element is to be created.</param>
/// <param name="propertyAssignments">List of domain property id/value pairs to set once the element is created.</param>
public ExampleElement(DslModeling::Store store, params DslModeling::PropertyAssignment[] propertyAssignments)
: this(store != null ? store.DefaultPartition : null, propertyAssignments)
{
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="partition">Partition where new element is to be created.</param>
/// <param name="propertyAssignments">List of domain property id/value pairs to set once the element is created.</param>
public ExampleElement(DslModeling::Partition partition, params DslModeling::PropertyAssignment[] propertyAssignments)
: base(partition, propertyAssignments)
{
}
#endregion
#region Name domain property code
/// <summary>
/// Name domain property Id.
/// </summary>
public static readonly global::System.Guid NameDomainPropertyId = new global::System.Guid(0x1fb62aa3, 0xe855, 0x4f2f, 0x89, 0x69, 0xbc, 0xf7, 0xc9, 0xbe, 0xca, 0xde);
/// <summary>
/// Storage for Name
/// </summary>
private global::System.String namePropertyStorage = string.Empty;
/// <summary>
/// Gets or sets the value of Name domain property.
/// Description for Company.Smpl.ExampleElement.Name
/// </summary>
[DslDesign::DisplayNameResource("Company.Smpl.ExampleElement/Name.DisplayName", typeof(global::Company.Smpl.SmplDomainModel), "Company.Smpl.GeneratedCode.DomainModelResx")]
[DslDesign::DescriptionResource("Company.Smpl.ExampleElement/Name.Description", typeof(global::Company.Smpl.SmplDomainModel), "Company.Smpl.GeneratedCode.DomainModelResx")]
[DslModeling::ElementName]
[DslModeling::DomainObjectId("1fb62aa3-e855-4f2f-8969-bcf7c9becade")]
public global::System.String Name
{
[global::System.Diagnostics.DebuggerStepThrough]
get
{
return namePropertyStorage;
}
[global::System.Diagnostics.DebuggerStepThrough]
set
{
NamePropertyHandler.Instance.SetValue(this, value);
}
}
/// <summary>
/// Value handler for the ExampleElement.Name domain property.
/// </summary>
internal sealed partial class NamePropertyHandler : DslModeling::DomainPropertyValueHandler<ExampleElement, global::System.String>
{
private NamePropertyHandler() { }
/// <summary>
/// Gets the singleton instance of the ExampleElement.Name domain property value handler.
/// </summary>
public static readonly NamePropertyHandler Instance = new NamePropertyHandler();
/// <summary>
/// Gets the Id of the ExampleElement.Name domain property.
/// </summary>
public sealed override global::System.Guid DomainPropertyId
{
[global::System.Diagnostics.DebuggerStepThrough]
get
{
return NameDomainPropertyId;
}
}
/// <summary>
/// Gets a strongly-typed value of the property on specified element.
/// </summary>
/// <param name="element">Element which owns the property.</param>
/// <returns>Property value.</returns>
public override sealed global::System.String GetValue(ExampleElement element)
{
if (element == null) throw new global::System.ArgumentNullException("element");
return element.namePropertyStorage;
}
/// <summary>
/// Sets property value on an element.
/// </summary>
/// <param name="element">Element which owns the property.</param>
/// <param name="newValue">New property value.</param>
public override sealed void SetValue(ExampleElement element, global::System.String newValue)
{
if (element == null) throw new global::System.ArgumentNullException("element");
global::System.String oldValue = GetValue(element);
if (newValue != oldValue)
{
ValueChanging(element, oldValue, newValue);
element.namePropertyStorage = newValue;
ValueChanged(element, oldValue, newValue);
}
}
}
#endregion
#region Type domain property code
/// <summary>
/// Type domain property Id.
/// </summary>
public static readonly global::System.Guid TypeDomainPropertyId = new global::System.Guid(0x36d3d29c, 0xdd98, 0x43c6, 0xbd, 0xcc, 0x31, 0xac, 0x61, 0xfa, 0x55, 0xf7);
/// <summary>
/// Storage for Type
/// </summary>
private global::System.String typePropertyStorage = string.Empty;
/// <summary>
/// Gets or sets the value of Type domain property.
/// Description for Company.Smpl.ExampleElement.Type
/// </summary>
[System.ComponentModel.EditorAttribute(typeof(Company.Smpl.PropertyTypeNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
[DslDesign::DisplayNameResource("Company.Smpl.ExampleElement/Type.DisplayName", typeof(global::Company.Smpl.SmplDomainModel), "Company.Smpl.GeneratedCode.DomainModelResx")]
[DslDesign::DescriptionResource("Company.Smpl.ExampleElement/Type.Description", typeof(global::Company.Smpl.SmplDomainModel), "Company.Smpl.GeneratedCode.DomainModelResx")]
[DslModeling::DomainObjectId("36d3d29c-dd98-43c6-bdcc-31ac61fa55f7")]
public global::System.String Type
{
[global::System.Diagnostics.DebuggerStepThrough]
get
{
return typePropertyStorage;
}
[global::System.Diagnostics.DebuggerStepThrough]
set
{
TypePropertyHandler.Instance.SetValue(this, value);
}
}
/// <summary>
/// Value handler for the ExampleElement.Type domain property.
/// </summary>
internal sealed partial class TypePropertyHandler : DslModeling::DomainPropertyValueHandler<ExampleElement, global::System.String>
{
private TypePropertyHandler() { }
/// <summary>
/// Gets the singleton instance of the ExampleElement.Type domain property value handler.
/// </summary>
public static readonly TypePropertyHandler Instance = new TypePropertyHandler();
/// <summary>
/// Gets the Id of the ExampleElement.Type domain property.
/// </summary>
public sealed override global::System.Guid DomainPropertyId
{
[global::System.Diagnostics.DebuggerStepThrough]
get
{
return TypeDomainPropertyId;
}
}
/// <summary>
/// Gets a strongly-typed value of the property on specified element.
/// </summary>
/// <param name="element">Element which owns the property.</param>
/// <returns>Property value.</returns>
public override sealed global::System.String GetValue(ExampleElement element)
{
if (element == null) throw new global::System.ArgumentNullException("element");
return element.typePropertyStorage;
}
/// <summary>
/// Sets property value on an element.
/// </summary>
/// <param name="element">Element which owns the property.</param>
/// <param name="newValue">New property value.</param>
public override sealed void SetValue(ExampleElement element, global::System.String newValue)
{
if (element == null) throw new global::System.ArgumentNullException("element");
global::System.String oldValue = GetValue(element);
if (newValue != oldValue)
{
ValueChanging(element, oldValue, newValue);
element.typePropertyStorage = newValue;
ValueChanged(element, oldValue, newValue);
}
}
}
#endregion
#region ExampleModel opposite domain role accessor
/// <summary>
/// Gets or sets ExampleModel.
/// </summary>
public virtual ExampleModel ExampleModel
{
[global::System.Diagnostics.DebuggerStepThrough]
get
{
return DslModeling::DomainRoleInfo.GetLinkedElement(this, global::Company.Smpl.ExampleModelHasElements.ElementDomainRoleId) as ExampleModel;
}
[global::System.Diagnostics.DebuggerStepThrough]
set
{
DslModeling::DomainRoleInfo.SetLinkedElement(this, global::Company.Smpl.ExampleModelHasElements.ElementDomainRoleId, value);
}
}
#endregion
}
}