I am trying to create a sample project with following scenario:
A DataBank CI class which holds information about databases. This class is defined like this:
<ClassType ID="BIPCAssetClass.DataBank" Accessibility="Public" Abstract="false" Base="System!System.ConfigItem" Hosted="false" Singleton="false" Extension="false"> <Property ID="DataBankID" Type="string" AutoIncrement="true" Key="true" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false" Scale="0" DefaultValue="DataBank{0}" /> <Property ID="DataBankType" Type="enum" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false" Scale="0" EnumType="Enum.DataBankType" /> <Property ID="DataBankVersion" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false" Scale="0" /> <Property ID="DataBankUsage" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false" Scale="0" /> </ClassType>
We may define a relation between this class and the computer where this database is installed on:
<RelationshipTypes> <RelationshipType ID="IsInstalledOnComputer" Accessibility="Public" Abstract="false" Base="System!System.Reference"> <Source ID="Source_b67394ed_491b_43eb_a972_d8d0b8380aa2" MinCardinality="0" MaxCardinality="2147483647" Type="BIPCAssetClass.DataBank" /> <Target ID="Target_6132fa12_af98_4bb8_96ca_e039e7067682" MinCardinality="0" MaxCardinality="1" Type="System!System.Computer" /> </RelationshipType> </RelationshipTypes>
In order to make the user control save the relation, we may create a type projection like this:
<TypeProjections> <TypeProjection ID="Projection.DataBank" Accessibility="Public" Type="BIPCAssetClass.DataBank"> <Component Path="$Context/Path[Relationship='IsInstalledOnComputer']$" Alias="DataBankInstalledOnComputer" /> </TypeProjection> </TypeProjections>
So, in the Form Element, we reference this "Projection.DataBank" like this:
<Form ID="BIPCDataBank" Accessibility="Public" Target="Alias_f25ad0af_50e2_46ca_b7c7_46c2abb3303f!Projection.DataBank" Assembly="BIPCAssets" TypeName="BIPCAssets.DataBank"> <Category>Form</Category> </Form>
and the target refers to the sealed MP where TypeProjection is defined:
<Reference Alias="Alias_f25ad0af_50e2_46ca_b7c7_46c2abb3303f"> <ID>BIPC.Asset.DataBank</ID> <Version>1.0.0.1</Version> <PublicKeyToken>7a1fbae719247839</PublicKeyToken> </Reference>
Then after importing in the console, create a view referencing the class
BIPCAssetClass.DataBank
Meanwhile in the usercontrol, we have the following binding:
<smcontrols:SingleInstancePicker Instance="{Binding Path=System.Computer, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" BaseClassId="B4A14FFD-52C8-064F-C936-67616C245B35" Margin="5,0,10,0" MouseDoubleClick="SingleInstancePicker_MouseDoubleClick"/>
Though neither binding, nor Mouse double click works. He code for MouseDoubleClick is like this:
private void SingleInstancePicker_MouseDoubleClick(object sender, MouseButtonEventArgs e) { SingleInstancePicker singleInstancePicker = (SingleInstancePicker)sender; FormUtilities.Instance.PopoutForm(singleInstancePicker.Instance); }
What I have done wrong? Please point me to the right direction.
Thanks