本文整理汇总了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));
}
示例2: DecorateClass
public void DecorateClass(CodeTypeDeclaration typeDeclaration,
ISchema schema,
IDictionary<JsonSchema, SchemaImplementationDetails> implDetails,
INestedClassProvider internalClassProvider)
{
schema.ThrowIfNull("schema");
ImplementAdditionalProperties(typeDeclaration, schema.SchemaDetails, implDetails, internalClassProvider);
}
示例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());
}
示例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));
}
示例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));
}
}
示例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;
}
示例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++;
}