private static NativeStorePropertyDefinition GetPropDefByMapiNamedProp(NamedProp prop, PropType type, NativeStorePropertyDefinition.TypeCheckingFlag propertyTypeCheckingFlag) { if (prop == null) { return(null); } switch (prop.Kind) { case NamedPropKind.Id: return(GuidIdPropertyDefinition.InternalCreateCustom(string.Empty, type, prop.Guid, prop.Id, PropertyFlags.None, propertyTypeCheckingFlag, new PropertyDefinitionConstraint[0])); case NamedPropKind.String: if (GuidNamePropertyDefinition.IsValidName(prop.Guid, prop.Name)) { return(GuidNamePropertyDefinition.InternalCreate(string.Empty, InternalSchema.ClrTypeFromPropTagType(type), type, prop.Guid, prop.Name, PropertyFlags.None, propertyTypeCheckingFlag, true, PropertyDefinitionConstraint.None)); } return(null); default: throw new ArgumentOutOfRangeException("prop.Kind"); } }
public static GuidNamePropertyDefinition CreateCustom(string displayName, Type propertyType, Guid propertyGuid, string propertyName, PropertyFlags flags, params PropertyDefinitionConstraint[] constraints) { PropType mapiPropType = InternalSchema.PropTagTypeFromClrType(propertyType); return(GuidNamePropertyDefinition.InternalCreate(displayName, propertyType, mapiPropType, propertyGuid, propertyName, flags | PropertyFlags.Custom, NativeStorePropertyDefinition.TypeCheckingFlag.ThrowOnInvalidType, true, constraints)); }
internal static GuidNamePropertyDefinition InternalCreateCustom(string displayName, PropType mapiPropType, Guid propertyGuid, string propertyName, PropertyFlags flags, NativeStorePropertyDefinition.TypeCheckingFlag typeCheckingFlag, params PropertyDefinitionConstraint[] constraints) { Type propertyType = InternalSchema.ClrTypeFromPropTagType(mapiPropType); return(GuidNamePropertyDefinition.InternalCreate(displayName, propertyType, mapiPropType, propertyGuid, propertyName, flags | PropertyFlags.Custom, typeCheckingFlag, true, constraints)); }