public static OperationIncludeAttributes ToData(CdmOperationIncludeAttributes instance, ResolveOptions resOpt, CopyOptions options) { if (instance == null) { return(null); } OperationIncludeAttributes obj = OperationBasePersistence.ToData <OperationIncludeAttributes>(instance, resOpt, options); obj.IncludeAttributes = instance.IncludeAttributes; return(obj); }
public static Projection ToData(CdmProjection instance, ResolveOptions resOpt, CopyOptions options) { if (instance == null) { return(null); } dynamic source = null; if (instance.Source != null && instance.Source.GetType() == typeof(string)) { source = instance.Source; } else if (instance.Source != null && !string.IsNullOrWhiteSpace(instance.Source.NamedReference) && instance.Source.ExplicitReference == null) { source = instance.Source.NamedReference; } else if (instance.Source != null && instance.Source.GetType() == typeof(CdmEntityReference)) { source = EntityReferencePersistence.ToData(instance.Source, resOpt, options); } List <OperationBase> operations = null; if (instance.Operations != null && instance.Operations.Count > 0) { operations = new List <OperationBase>(); foreach (CdmOperationBase operation in instance.Operations) { switch (operation.ObjectType) { case CdmObjectType.OperationAddCountAttributeDef: OperationAddCountAttribute addCountAttributeOp = OperationAddCountAttributePersistence.ToData(operation as CdmOperationAddCountAttribute, resOpt, options); operations.Add(addCountAttributeOp); break; case CdmObjectType.OperationAddSupportingAttributeDef: OperationAddSupportingAttribute addSupportingAttributeOp = OperationAddSupportingAttributePersistence.ToData(operation as CdmOperationAddSupportingAttribute, resOpt, options); operations.Add(addSupportingAttributeOp); break; case CdmObjectType.OperationAddTypeAttributeDef: OperationAddTypeAttribute addTypeAttributeOp = OperationAddTypeAttributePersistence.ToData(operation as CdmOperationAddTypeAttribute, resOpt, options); operations.Add(addTypeAttributeOp); break; case CdmObjectType.OperationExcludeAttributesDef: OperationExcludeAttributes excludeAttributesOp = OperationExcludeAttributesPersistence.ToData(operation as CdmOperationExcludeAttributes, resOpt, options); operations.Add(excludeAttributesOp); break; case CdmObjectType.OperationArrayExpansionDef: OperationArrayExpansion arrayExpansionOp = OperationArrayExpansionPersistence.ToData(operation as CdmOperationArrayExpansion, resOpt, options); operations.Add(arrayExpansionOp); break; case CdmObjectType.OperationCombineAttributesDef: OperationCombineAttributes combineAttributesOp = OperationCombineAttributesPersistence.ToData(operation as CdmOperationCombineAttributes, resOpt, options); operations.Add(combineAttributesOp); break; case CdmObjectType.OperationRenameAttributesDef: OperationRenameAttributes renameAttributesOp = OperationRenameAttributesPersistence.ToData(operation as CdmOperationRenameAttributes, resOpt, options); operations.Add(renameAttributesOp); break; case CdmObjectType.OperationReplaceAsForeignKeyDef: OperationReplaceAsForeignKey replaceAsForeignKeyOp = OperationReplaceAsForeignKeyPersistence.ToData(operation as CdmOperationReplaceAsForeignKey, resOpt, options); operations.Add(replaceAsForeignKeyOp); break; case CdmObjectType.OperationIncludeAttributesDef: OperationIncludeAttributes includeAttributesOp = OperationIncludeAttributesPersistence.ToData(operation as CdmOperationIncludeAttributes, resOpt, options); operations.Add(includeAttributesOp); break; case CdmObjectType.OperationAddAttributeGroupDef: OperationAddAttributeGroup addAttributeGroupOp = OperationAddAttributeGroupPersistence.ToData(operation as CdmOperationAddAttributeGroup, resOpt, options); operations.Add(addAttributeGroupOp); break; default: OperationBase baseOp = new OperationBase(); baseOp.Type = OperationTypeConvertor.OperationTypeToString(CdmOperationType.Error); operations.Add(baseOp); break; } } } return(new Projection { Explanation = instance.Explanation, Source = source, Operations = operations, Condition = instance.Condition, RunSequentially = instance.RunSequentially }); }