本文整理汇总了C#中MetadataTypesConfig类的典型用法代码示例。如果您正苦于以下问题:C# MetadataTypesConfig类的具体用法?C# MetadataTypesConfig怎么用?C# MetadataTypesConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetadataTypesConfig类属于命名空间,在下文中一共展示了MetadataTypesConfig类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetMetadataTypes
public MetadataTypes GetMetadataTypes(IRequest req, MetadataTypesConfig config = null, Func<Operation, bool> predicate = null)
{
return GetMetadataTypesGenerator(config).GetMetadataTypes(req, predicate);
}
开发者ID:ServiceStack,项目名称:ServiceStack,代码行数:4,代码来源:NativeTypesMetadata.cs
示例2: GetMetadataTypesGenerator
internal MetadataTypesGenerator GetMetadataTypesGenerator(MetadataTypesConfig config)
{
return new MetadataTypesGenerator(meta, config ?? defaults);
}
开发者ID:ServiceStack,项目名称:ServiceStack,代码行数:4,代码来源:NativeTypesMetadata.cs
示例3: VbNetGenerator
public VbNetGenerator(MetadataTypesConfig config)
{
Config = config;
}
开发者ID:kerier,项目名称:ServiceStack,代码行数:4,代码来源:VbNetGenerator.cs
示例4: NativeTypesMetadata
public NativeTypesMetadata(ServiceMetadata meta, MetadataTypesConfig defaults)
{
this.meta = meta;
this.defaults = defaults;
}
开发者ID:ServiceStack,项目名称:ServiceStack,代码行数:5,代码来源:NativeTypesMetadata.cs
示例5: IgnoreType
public static bool IgnoreType(this MetadataType type, MetadataTypesConfig config, List<string> overrideIncludeType = null)
{
// If is a systemType and export types doesn't include this
if (type.IgnoreSystemType() && config.ExportTypes.All(x => x.Name != type.Name))
return true;
var includes = overrideIncludeType ?? config.IncludeTypes;
if (includes != null && !includes.Contains(type.Name))
return true;
if (config.ExcludeTypes != null &&
config.ExcludeTypes.Any(x => type.Name == x || type.Name.StartsWith(x + "`")))
return true;
return false;
}
开发者ID:ServiceStack,项目名称:ServiceStack,代码行数:16,代码来源:NativeTypesMetadata.cs
示例6: CSharpGenerator
public CSharpGenerator(MetadataTypesConfig config)
{
Config = config;
feature = HostContext.GetPlugin<NativeTypesFeature>();
}
开发者ID:yuinlin,项目名称:ServiceStack,代码行数:5,代码来源:CSharpGenerator.cs
示例7: IgnoreType
public static bool IgnoreType(this MetadataType type, MetadataTypesConfig config)
{
if (type.IgnoreSystemType())
return true;
if (config.IncludeTypes != null && !config.IncludeTypes.Contains(type.Name))
return true;
if (config.ExcludeTypes != null && config.ExcludeTypes.Contains(type.Name))
return true;
return false;
}
开发者ID:AimaTeam-hehai,项目名称:ServiceStack,代码行数:13,代码来源:NativeTypesMetadata.cs
示例8: MetadataTypesGenerator
public MetadataTypesGenerator(ServiceMetadata meta, MetadataTypesConfig config)
{
this.meta = meta;
this.config = config;
}
开发者ID:ServiceStack,项目名称:ServiceStack,代码行数:5,代码来源:NativeTypesMetadata.cs
示例9: JavaGenerator
public JavaGenerator(MetadataTypesConfig config)
{
Config = config;
}
开发者ID:zigmo,项目名称:ServiceStack,代码行数:4,代码来源:JavaGenerator.cs
示例10: GetMetadataTypes
public MetadataTypes GetMetadataTypes(IRequest req, MetadataTypesConfig config = null)
{
return GetMetadataTypesGenerator(config).GetMetadataTypes(req);
}
开发者ID:AimaTeam-hehai,项目名称:ServiceStack,代码行数:4,代码来源:NativeTypesMetadata.cs
示例11: SwiftGenerator
public SwiftGenerator(MetadataTypesConfig config)
{
Config = config;
feature = HostContext.GetPlugin<NativeTypesFeature>();
AllTypes = new List<MetadataType>();
}
开发者ID:yuinlin,项目名称:ServiceStack,代码行数:6,代码来源:SwiftGenerator.cs
示例12: GetMetadataTypes
public MetadataTypes GetMetadataTypes(IRequest req, MetadataTypesConfig config = null)
{
return new MetadataTypesGenerator(meta, config ?? defaults).GetMetadataTypes(req);
}
开发者ID:Kanarej,项目名称:ServiceStack,代码行数:4,代码来源:NativeTypesMetadata.cs
示例13: IgnoreType
public static bool IgnoreType(this MetadataType type, MetadataTypesConfig config)
{
if (type.IgnoreSystemType() && config.ExportTypes.All(x => x.Name != type.Name))
return true;
if (config.IncludeTypes != null && !config.IncludeTypes.Contains(type.Name))
return true;
if (config.ExcludeTypes != null &&
config.ExcludeTypes.Any(x => type.Name == x || type.Name.StartsWith(x + "`")))
return true;
return false;
}
开发者ID:jin29neci,项目名称:ServiceStack,代码行数:14,代码来源:NativeTypesMetadata.cs
示例14: RemoveIgnoredTypesForNet
public static void RemoveIgnoredTypesForNet(this MetadataTypes metadata, MetadataTypesConfig config)
{
metadata.RemoveIgnoredTypes(config);
//Don't include Exported Types in System
metadata.Types.RemoveAll(x => x.IgnoreSystemType());
}
开发者ID:ServiceStack,项目名称:ServiceStack,代码行数:6,代码来源:NativeTypesMetadata.cs
示例15: TypeScriptGenerator
public TypeScriptGenerator(MetadataTypesConfig config)
{
Config = config;
}
开发者ID:ricardoshimoda,项目名称:ServiceStack,代码行数:4,代码来源:TypeScriptGenerator.cs
示例16: RemoveIgnoredTypes
public static void RemoveIgnoredTypes(this MetadataTypes metadata, MetadataTypesConfig config)
{
var includeList = GetIncludeList(metadata, config);
metadata.Types.RemoveAll(x => x.IgnoreType(config, includeList));
var matchingResponseTypes = includeList != null
? metadata.Operations.Where(x => x.Response != null && includeList.Contains(x.Response.Name))
.Map(x => x.Response).ToArray()
: TypeConstants<MetadataType>.EmptyArray;
metadata.Operations.RemoveAll(x => x.Request.IgnoreType(config, includeList));
metadata.Operations.Each(x => {
if (x.Response != null && x.Response.IgnoreType(config, includeList))
{
x.Response = null;
}
});
//When the included Type is a Response Type because defined in another Service that's not included
//ref: https://forums.servicestack.net/t/class-is-missing-from-generated-code/3030
foreach (var responseType in matchingResponseTypes)
{
if (!metadata.Operations.Any(x => x.Response != null && x.Response.Name == responseType.Name)
&& metadata.Types.All(x => x.Name != responseType.Name))
{
metadata.Types.Add(responseType);
}
}
}
开发者ID:ServiceStack,项目名称:ServiceStack,代码行数:30,代码来源:NativeTypesMetadata.cs
示例17: GetIncludeList
public static List<string> GetIncludeList(MetadataTypes metadata, MetadataTypesConfig config)
{
const string wildCard = ".*";
if (config.IncludeTypes == null)
return null;
var typesToExpand = config.IncludeTypes
.Where(s => s.Length > 2 && s.EndsWith(wildCard))
.Map(s => s.Substring(0, s.Length - 2));
if (typesToExpand.Count == 0)
return config.IncludeTypes;
// From IncludeTypes get the corresponding MetadataTypes
var includedMetadataTypes = metadata.Operations
.Select(o => o.Request)
.Where(t => typesToExpand.Contains(t.Name))
.ToList();
var includeSet = includedMetadataTypes
.Where(x => x.ReturnMarkerTypeName != null)
.Select(x => x.ReturnMarkerTypeName.Name)
.ToHashSet();
var includedResponses = metadata.Operations
.Where(t => typesToExpand.Contains(t.Request.Name) && t.Response != null)
.Select(o => o.Response)
.ToList();
includedResponses.ForEach(x => includeSet.Add(x.Name));
var returnTypesForInclude = metadata.Operations
.Where(x => x.Response != null && includeSet.Contains(x.Response.Name))
.Map(x => x.Response);
// GetReferencedTypes for both request + response objects
var referenceTypes = includedMetadataTypes
.Union(returnTypesForInclude)
.Where(x => x != null)
.SelectMany(x => x.GetReferencedTypeNames());
return referenceTypes
.Union(config.IncludeTypes)
.Union(typesToExpand)
.Union(returnTypesForInclude.Select(x => x.Name))
.Distinct()
.ToList();
}
开发者ID:ServiceStack,项目名称:ServiceStack,代码行数:48,代码来源:NativeTypesMetadata.cs
示例18: RemoveIgnoredTypes
public static void RemoveIgnoredTypes(this MetadataTypes metadata, MetadataTypesConfig config)
{
var includeList = GetIncludeList(metadata, config);
metadata.Types.RemoveAll(x => x.IgnoreType(config, includeList));
metadata.Operations.RemoveAll(x => x.Request.IgnoreType(config, includeList));
metadata.Operations.Each(x => {
if (x.Response != null && x.Response.IgnoreType(config, includeList))
{
x.Response = null;
}
});
}
开发者ID:xiongtec,项目名称:ServiceStack,代码行数:13,代码来源:NativeTypesMetadata.cs
示例19: CSharpGenerator
public CSharpGenerator(MetadataTypesConfig config)
{
Config = config;
}
开发者ID:softwx,项目名称:ServiceStack,代码行数:4,代码来源:CSharpGenerator.cs
示例20: GetTypeName
public static string GetTypeName(this MetadataPropertyType prop, MetadataTypesConfig config, List<MetadataType> allTypes)
{
if (prop.IsValueType != true || prop.IsEnum == true)
return prop.Type;
if (prop.IsSystemType == true)
{
if (prop.Type != "Nullable`1" || prop.GenericArgs?.Length != 1)
return prop.Type;
if (config.ExportValueTypes)
return prop.Type;
// Find out if the ValueType is not a SystemType or Enum by looking if this Info is declared in another prop
var genericArg = prop.GenericArgs[0];
var typeInfo = allTypes.Where(x => x.Properties != null)
.SelectMany(x => x.Properties)
.FirstOrDefault(x => x.Type == genericArg);
return typeInfo != null && typeInfo.IsSystemType != true && typeInfo.IsEnum != true
? "String"
: prop.Type;
}
//Whether or not to emit the Struct Type Name, info: https://github.com/ServiceStack/Issues/issues/503#issuecomment-262133343
return config.ExportValueTypes
? prop.Type
: "String";
}
开发者ID:ServiceStack,项目名称:ServiceStack,代码行数:29,代码来源:NativeTypesMetadata.cs
注:本文中的MetadataTypesConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论