This interface is used togehter with the attribute BuildNewHandlerAttribute. It is possible to overwrite the default behavior when a new data item is created through the method New<(Of <<'(TData>)>>)()()()() To do this, you have to implement this interface and attach it to your IData type by using the attribute BuildNewHandlerAttribute

Examples

CopyC#
[BuildNewHandlerAttribute(typeof(MyBuildNewHandler))
[AutoUpdateble]
[KeyPropertyName("Id")]
[DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]
[ImmutableTypeId("{10D6CA29-5B01-45EE-9405-9B027F4C949C}")]    
interface IMyDataType : IData
{
    [StoreFieldType(PhysicalStoreFieldType.Guid)]
    [ImmutableFieldId("{B99F4AF2-859D-4235-887B-E5A06BBB9892}")]
    Guid Id { get; set; }

    [StoreFieldType(PhysicalStoreFieldType.String, 256)]
    [ImmutableFieldId("{A8127C77-5083-4409-9EA6-1E3BB696310D}")]
    string Name { get; set; }
}

class MyBuildNewHandler : IBuildNewHandler
{
    public Type GetTypeToBuild(Type dataType)
    {
        /* dataType will always be typeof(IMyDataType) */

        return typeof(MyDataType);
    }
}


class MyDataType : IMyDataType
{
    puglic MyDataType()
    {
        /* All new instances of IMyDataType will becrated through this constructor */
        this.Id = Guid.NewGuid();
        this.Name = "RandomName";
    }

    public Id { get; set; }

    public Name { get; set; }
}

Namespace: Composite.Data
Assembly: Composite (in Composite.dll) Version: 6.1.6325.31818

Syntax

C#
public interface IBuildNewHandler
Visual Basic
Public Interface IBuildNewHandler
Visual C++
public interface class IBuildNewHandler

See Also