public static OperationIncludeAttributes ToData(CdmOperationIncludeAttributes instance, ResolveOptions resOpt, CopyOptions options)
        {
            if (instance == null)
            {
                return(null);
            }

            return(new OperationIncludeAttributes
            {
                Type = OperationTypeConvertor.OperationTypeToString(CdmOperationType.IncludeAttributes),
                Explanation = instance.Explanation,
                IncludeAttributes = instance.IncludeAttributes,
            });
        }
        public static OperationAddAttributeGroup ToData(CdmOperationAddAttributeGroup instance, ResolveOptions resOpt, CopyOptions options)
        {
            if (instance == null)
            {
                return(null);
            }

            return(new OperationAddAttributeGroup
            {
                Type = OperationTypeConvertor.OperationTypeToString(CdmOperationType.AddAttributeGroup),
                AttributeGroupName = instance.AttributeGroupName,
                Explanation = instance.Explanation
            });
        }
        public static CdmOperationArrayExpansion FromData(CdmCorpusContext ctx, JToken obj)
        {
            if (obj == null)
            {
                return(null);
            }

            CdmOperationArrayExpansion arrayExpansionOp = ctx.Corpus.MakeObject <CdmOperationArrayExpansion>(CdmObjectType.OperationArrayExpansionDef);

            if (obj["$type"] != null && !StringUtils.EqualsWithIgnoreCase(obj["$type"].ToString(), OperationTypeConvertor.OperationTypeToString(CdmOperationType.ArrayExpansion)))
            {
                Logger.Error(nameof(OperationArrayExpansionPersistence), ctx, $"$type {(string)obj["$type"]} is invalid for this operation.");
            }
            else
            {
                arrayExpansionOp.Type = CdmOperationType.ArrayExpansion;
            }
            if (obj["explanation"] != null)
            {
                arrayExpansionOp.Explanation = (string)obj["explanation"];
            }
            arrayExpansionOp.StartOrdinal = (int?)obj["startOrdinal"];
            arrayExpansionOp.EndOrdinal   = (int?)obj["endOrdinal"];

            return(arrayExpansionOp);
        }
Ejemplo n.º 4
0
        public static CdmOperationRenameAttributes FromData(CdmCorpusContext ctx, JToken obj)
        {
            if (obj == null)
            {
                return(null);
            }

            CdmOperationRenameAttributes renameAttributesOp = ctx.Corpus.MakeObject <CdmOperationRenameAttributes>(CdmObjectType.OperationRenameAttributesDef);


            if (obj["$type"] != null && !StringUtils.EqualsWithIgnoreCase(obj["$type"].ToString(), OperationTypeConvertor.OperationTypeToString(CdmOperationType.RenameAttributes)))
            {
                Logger.Error(nameof(OperationRenameAttributesPersistence), ctx, $"$type {obj["$type"].ToString()} is invalid for this operation.");
            }
            else
            {
                renameAttributesOp.Type = CdmOperationType.RenameAttributes;
            }
            if (obj["explanation"] != null)
            {
                renameAttributesOp.Explanation = (string)obj["explanation"];
            }
            renameAttributesOp.RenameFormat = obj["renameFormat"]?.ToString();
            renameAttributesOp.ApplyTo      = obj["applyTo"]?.ToObject <dynamic>();

            return(renameAttributesOp);
        }