当前位置: 首页>>代码示例>>C#>>正文


C# ISchema.ThrowIfNull方法代码示例

本文整理汇总了C#中ISchema.ThrowIfNull方法的典型用法代码示例。如果您正苦于以下问题:C# ISchema.ThrowIfNull方法的具体用法?C# ISchema.ThrowIfNull怎么用?C# ISchema.ThrowIfNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISchema的用法示例。


在下文中一共展示了ISchema.ThrowIfNull方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DecorateClass

        public void DecorateClass(CodeTypeDeclaration typeDeclaration,
            ISchema schema,
            IDictionary<JsonSchema, SchemaImplementationDetails> implDetails,
            INestedClassProvider internalClassProvider)
        {
            typeDeclaration.ThrowIfNull("typeDeclaration");
            schema.ThrowIfNull("schema");
            implDetails.ThrowIfNull("implDetails");
            internalClassProvider.ThrowIfNull("internalClassProvider");

            JsonSchema details = schema.SchemaDetails;
            details.ThrowIfNull("schemaDetails");

            // Check if this decorator can be applied to the schema);
            if (details.Type != JsonSchemaType.Array)
            {
                return;
            }

            if (details.Items == null || details.Items.Count != 1)
            {
                logger.Warning("Found array scheme of unhandled type. {0}", details);
                return; // not supported
            }

            // Generate or find the nested type
            JsonSchema itemScheme = details.Items[0];
            SchemaImplementationDetails implDetail = implDetails[itemScheme];
            implDetail.ProposedName = "Entry"; // Change the name to a custom one.
            CodeTypeReference item = SchemaDecoratorUtil.GetCodeType(itemScheme, implDetail, internalClassProvider);

            // Insert the base type before any interface declaration
            var baseType = string.Format("List<{0}>", item.BaseType);
            typeDeclaration.BaseTypes.Insert(0, new CodeTypeReference(baseType));
        }
开发者ID:nick0816,项目名称:LoggenCSG,代码行数:35,代码来源:ArraySchemaDecorator.cs

示例2: DecorateClass

 public void DecorateClass(CodeTypeDeclaration typeDeclaration,
                           ISchema schema,
                           IDictionary<JsonSchema, SchemaImplementationDetails> implDetails,
                           INestedClassProvider internalClassProvider)
 {
     schema.ThrowIfNull("schema");
     ImplementAdditionalProperties(typeDeclaration, schema.SchemaDetails, implDetails, internalClassProvider);
 }
开发者ID:jithuin,项目名称:infogeezer,代码行数:8,代码来源:AdditionalPropertiesSchemaDecorator.cs

示例3: DecorateClass

 public void DecorateClass(CodeTypeDeclaration typeDeclaration,
                           ISchema schema,
                           IDictionary<JsonSchema, SchemaImplementationDetails> implDetails,
                           INestedClassProvider internalClassProvider)
 {
     typeDeclaration.ThrowIfNull("typeDeclaration");
     schema.ThrowIfNull("schema");
     implDetails.ThrowIfNull("details");
     internalClassProvider.ThrowIfNull("internalClassProvider");
     typeDeclaration.Members.AddRange(
         GenerateAllFields(schema.Name, schema.SchemaDetails, implDetails, internalClassProvider).ToArray());
 }
开发者ID:JANCARLO123,项目名称:google-apis,代码行数:12,代码来源:StandardPropertyFieldDecorator.cs

示例4: DecorateClass

        public void DecorateClass(CodeTypeDeclaration typeDeclaration,
                                  ISchema schema,
                                  IDictionary<JsonSchema, SchemaImplementationDetails> implDetails,
                                  INestedClassProvider internalClassProvider)
        {
            typeDeclaration.ThrowIfNull("typeDeclaration");
            schema.ThrowIfNull("schema");
            implDetails.ThrowIfNull("implDetails");
            internalClassProvider.ThrowIfNull("internalClassProvider");
            schema.SchemaDetails.ThrowIfNull("schema.SchemaDetails");

            typeDeclaration.Comments.AddRange(CreateComment(schema.SchemaDetails));
        }
开发者ID:JANCARLO123,项目名称:google-apis,代码行数:13,代码来源:StandardSchemaCommentDecorator.cs

示例5: DecorateClass

        public void DecorateClass(CodeTypeDeclaration typeDeclaration,
                                  ISchema schema,
                                  IDictionary<JsonSchema, SchemaImplementationDetails> implDetails,
                                  INestedClassProvider internalClassProvider)
        {
            typeDeclaration.ThrowIfNull("typeDeclaration");
            schema.ThrowIfNull("schema");
            implDetails.ThrowIfNull("implDetails");

            SchemaImplementationDetails details = implDetails[schema.SchemaDetails];

            // If this method is refered as a result directly, add an inheritance to IResponse and implement
            // the interface
            if (details.IsMethodResult)
            {
                logger.Debug("Applying decorator to schema "+schema.Name);
                typeDeclaration.BaseTypes.Add(GetIResponseBaseType());
                typeDeclaration.Members.AddRange(CreateETagProperty(typeDeclaration));
            }
        }
开发者ID:JANCARLO123,项目名称:google-apis,代码行数:20,代码来源:ResponseInterfaceDecorator.cs

示例6: CreateClass

        /// <summary>
        /// Creates a fully working class for the specified schema.
        /// </summary>
        public CodeTypeDeclaration CreateClass(ISchema schema,
                                               IDictionary<JsonSchema, SchemaImplementationDetails> detailCollection,
                                               IEnumerable<string> otherSchemaNames)
        {
            schema.ThrowIfNull("schema");
            detailCollection.ThrowIfNull("detailCollection");
            otherSchemaNames.ThrowIfNull("otherSchemaNames");

            // Get relevant name collection
            IEnumerable<string> relevantNames = otherSchemaNames.Without(schema.Name);

            string className = GeneratorUtils.GetClassName(schema, relevantNames);
            var typeDeclaration = new CodeTypeDeclaration(className);
            var nestedClassGenerator = new NestedClassGenerator(typeDeclaration, decorators, "");
            foreach (ISchemaDecorator schemaDecorator in decorators)
            {
                schemaDecorator.DecorateClass(typeDeclaration, schema, detailCollection, nestedClassGenerator);
            }
            nestedClassGenerator.GenerateNestedClasses(detailCollection);

            return typeDeclaration;
        }
开发者ID:jithuin,项目名称:infogeezer,代码行数:25,代码来源:SchemaGenerator.cs

示例7: DecorateClass

 public void DecorateClass(CodeTypeDeclaration typeDeclaration,
                           ISchema schema,
                           IDictionary<JsonSchema, SchemaImplementationDetails> implDetails,
                           INestedClassProvider internalClassProvider)
 {
     typeDeclaration.ThrowIfNull("typeDeclaration");
     schema.ThrowIfNull("schema");
     internalClassProvider.ThrowIfNull("internalClassProvider");
     Count++;
 }
开发者ID:JANCARLO123,项目名称:google-apis,代码行数:10,代码来源:SchemaGeneratorTest.cs


注:本文中的ISchema.ThrowIfNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。