C# Class SIL.FieldWorks.FDO.DomainServices.GhostParentHelper

This class helps manage "ghost" virtual properties. The characteristic of such a property is that it contains a mixture of objects of a 'signature' class (or a subclass) and objects of a 'parent' class, which are put into the list when they have no children of the signature class in a specified owning property. Bulk edit operations may insert a suitable child if necessary to set a value for a parent-type object.
Datei anzeigen Open project: sillsdev/FieldWorks

Public Methods

Method Description
Create ( IFdoServiceLocator services, string classDotMethod ) : GhostParentHelper

Returns GPHs for the four properties we currently know about.

CreateIfPossible ( IFdoServiceLocator services, int flid ) : GhostParentHelper

Return a ghost parent helper based on a flid, or null if this flid does not need one.

CreateIfPossible ( IFdoServiceLocator services, string classDotMethod ) : GhostParentHelper

Returns GPHs for the four properties we currently know about, or null if not a known property that has ghosts.

FindOrCreateOwnerOfTargetProp ( int hvoItem, int flidBasicProp ) : int

Like GetOwnerOfTargetProperty, but will create a child if necessary so as never to return zero. Caller must ensure we are in a UOW.

GetBulkEditDestinationClass ( FdoCache cache, int listFlid ) : int

Get the destination class for the specified flid, as used in bulk edit. For this purpose we need to override the destination class of the fields that have ghost parent helpers, since the properties hold a mixture of classes and therefore have CmObject as their signature, but the bulk edit code needs to treat them as having the class they primarily contain.

GetOwnerOfTargetProperty ( int hvo ) : int

Get the object related to hvo that has the basic properties of interest: that is, a child object. hvo is assumed to be the desired object unless it is of the parent class, in which case, we return its first child if any, or zero if it has no relevant children.

IsGhostOwnerChildless ( int hvoItem ) : bool

Return true if the target object (which must be of the owner class) has no children in the relevant property.

IsGhostOwnerClass ( int hvo ) : bool

Return true if the object represented by the HVO is of the parent object class. Enhance JohnT: improve name!

Private Methods

Method Description
ClassToCreate ( int hvoItem, int flidBasicProp ) : int

Override if you should always create a particular class.

CreateOwnerOfTargetProp ( int hvoItem, int flidBasicProp ) : int

create the first child for this ghost owner

GetFirstChildFromParent ( int hvoParent ) : int
GetSda ( ) : ISilDataAccessManaged
GhostParentHelper ( IFdoServiceLocator services, int parentClsid, int flidOwning ) : System
IsOwningPropVector ( ) : bool

Method Details

Create() public static method

Returns GPHs for the four properties we currently know about.
public static Create ( IFdoServiceLocator services, string classDotMethod ) : GhostParentHelper
services IFdoServiceLocator
classDotMethod string
return GhostParentHelper

CreateIfPossible() public static method

Return a ghost parent helper based on a flid, or null if this flid does not need one.
public static CreateIfPossible ( IFdoServiceLocator services, int flid ) : GhostParentHelper
services IFdoServiceLocator
flid int
return GhostParentHelper

CreateIfPossible() public static method

Returns GPHs for the four properties we currently know about, or null if not a known property that has ghosts.
public static CreateIfPossible ( IFdoServiceLocator services, string classDotMethod ) : GhostParentHelper
services IFdoServiceLocator
classDotMethod string
return GhostParentHelper

FindOrCreateOwnerOfTargetProp() public method

Like GetOwnerOfTargetProperty, but will create a child if necessary so as never to return zero. Caller must ensure we are in a UOW.
public FindOrCreateOwnerOfTargetProp ( int hvoItem, int flidBasicProp ) : int
hvoItem int
flidBasicProp int
return int

GetBulkEditDestinationClass() public static method

Get the destination class for the specified flid, as used in bulk edit. For this purpose we need to override the destination class of the fields that have ghost parent helpers, since the properties hold a mixture of classes and therefore have CmObject as their signature, but the bulk edit code needs to treat them as having the class they primarily contain.
public static GetBulkEditDestinationClass ( FdoCache cache, int listFlid ) : int
cache FdoCache
listFlid int
return int

GetOwnerOfTargetProperty() public method

Get the object related to hvo that has the basic properties of interest: that is, a child object. hvo is assumed to be the desired object unless it is of the parent class, in which case, we return its first child if any, or zero if it has no relevant children.
public GetOwnerOfTargetProperty ( int hvo ) : int
hvo int
return int

IsGhostOwnerChildless() public method

Return true if the target object (which must be of the owner class) has no children in the relevant property.
public IsGhostOwnerChildless ( int hvoItem ) : bool
hvoItem int
return bool

IsGhostOwnerClass() public method

Return true if the object represented by the HVO is of the parent object class. Enhance JohnT: improve name!
public IsGhostOwnerClass ( int hvo ) : bool
hvo int
return bool