Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Visual Studio SDK
 Providing Custom Constructors

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Domain-Specific Language Tools
Providing Custom Constructors

Updated: November 2007

You can set the HasCustomConstructor property on a domain class to true to indicate that you are providing one or more custom constructors.

The following example uses the sample model Library.dsl, to define a custom constructor for a domain class called CirculationBook. To add custom constructors, you create a partial class, define one or more constructors in it, and then add the partial class to the project.

The CirculationBook domain class has the GeneratesDoubleDerived property set to true. Therefore, you must define custom constructors for both the CirculationBook class and the CirculationBookBase abstract base class.

using Microsoft.VisualStudio.Modeling;

namespace ExampleNamespace
{
    public partial class CirculationBookBase
    {
        public CirculationBookBase(Partition partition, PropertyAssignment[] propertyAssignments) : base(partition, propertyAssignments)
        {
        }
    }
    public partial class CirculationBook
    {
        public CirculationBook(Partition partition, PropertyAssignment[] propertyAssignments) : base(partition, propertyAssignments)
        {
        }
    }
}
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker