本文整理汇总了C#中Composite.Data.DynamicTypes.DataTypeDescriptor.GetFullInterfaceName方法的典型用法代码示例。如果您正苦于以下问题:C# DataTypeDescriptor.GetFullInterfaceName方法的具体用法?C# DataTypeDescriptor.GetFullInterfaceName怎么用?C# DataTypeDescriptor.GetFullInterfaceName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composite.Data.DynamicTypes.DataTypeDescriptor
的用法示例。
在下文中一共展示了DataTypeDescriptor.GetFullInterfaceName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryGetType
internal static Type TryGetType(DataTypeDescriptor dataTypeDescriptor, bool forceReCompilation, out bool codeGenerationNeeded)
{
Verify.ArgumentNotNull(dataTypeDescriptor, "dataTypeDescriptor");
codeGenerationNeeded = false;
Type type;
if (!forceReCompilation)
{
type = TypeManager.TryGetType(dataTypeDescriptor.GetFullInterfaceName());
if (type != null) return type;
if (!dataTypeDescriptor.IsCodeGenerated)
{
type = TypeManager.TryGetType(dataTypeDescriptor.TypeManagerTypeName);
if (type != null) return type;
}
}
if (!dataTypeDescriptor.IsCodeGenerated)
{
return null;
}
if (forceReCompilation)
{
type = TypeManager.TryGetType(dataTypeDescriptor.GetFullInterfaceName());
if (type != null) return type;
}
codeGenerationNeeded = true;
return null;
}
示例2: GetType
/// <summary>
/// This method will return type given by the dataTypeDescriptor.
/// If the data type does not exist, one will be dynamically
/// runtime code generated.
/// </summary>
/// <param name="dataTypeDescriptor"></param>
/// <param name="forceReCompilation">If this is true a new type will be compiled regardless if one already exists.</param>
/// <returns></returns>
public static Type GetType(DataTypeDescriptor dataTypeDescriptor, bool forceReCompilation = false)
{
bool codeGenerationNeeded;
Type type = TryGetType(dataTypeDescriptor, forceReCompilation, out codeGenerationNeeded);
if (type != null)
{
return type;
}
if (codeGenerationNeeded)
{
lock (_lock)
{
type = TypeManager.TryGetType(dataTypeDescriptor.GetFullInterfaceName());
if (type != null) return type;
var codeGenerationBuilder = new CodeGenerationBuilder("DataInterface: " + dataTypeDescriptor.Name);
InterfaceCodeGenerator.AddAssemblyReferences(codeGenerationBuilder, dataTypeDescriptor);
InterfaceCodeGenerator.AddInterfaceTypeCode(codeGenerationBuilder, dataTypeDescriptor);
IEnumerable<Type> types = CodeGenerationManager.CompileRuntimeTempTypes(codeGenerationBuilder);
return types.Single();
}
}
return null;
}
示例3: GetDataWrapperType
public static Type GetDataWrapperType(DataTypeDescriptor dataTypeDescriptor)
{
Type wrapperType = TryGetWrapperType(dataTypeDescriptor.GetFullInterfaceName());
if (wrapperType != null) return wrapperType;
lock (_lock)
{
wrapperType = TryGetWrapperType(dataTypeDescriptor.GetFullInterfaceName());
if (wrapperType != null) return wrapperType;
var codeGenerationBuilder = new CodeGenerationBuilder("DataWrapper:" + dataTypeDescriptor.GetFullInterfaceName());
DataWrapperCodeGenerator.AddDataWrapperClassCode(codeGenerationBuilder, dataTypeDescriptor);
IEnumerable<Type> types = CodeGenerationManager.CompileRuntimeTempTypes(codeGenerationBuilder);
return types.Single();
}
}
示例4: GetDataType
/// <summary>
/// Gets the runtime data type for the given data type id.
/// In case of generated types, this call might result in a interface code compilation.
/// </summary>
/// <param name="dataTypeDescriptor">
/// The DataTypeDescriptor for the data type.
/// </param>
/// <returns>Returns the data type. Never null.</returns>
public static Type GetDataType(DataTypeDescriptor dataTypeDescriptor)
{
Verify.ArgumentNotNull(dataTypeDescriptor, "dataTypeDescriptor");
Type loadedDataType = _LoadedDataTypes.FirstOrDefault(f => f.FullName == dataTypeDescriptor.GetFullInterfaceName());
if (loadedDataType != null) return loadedDataType;
Type type = InterfaceCodeManager.GetType(dataTypeDescriptor);
return type;
}
示例5: CreateCodeTypeDeclaration
private static CodeTypeDeclaration CreateCodeTypeDeclaration(DataTypeDescriptor dataTypeDescriptor)
{
string fullName = dataTypeDescriptor.GetFullInterfaceName();
IEnumerable<Tuple<string, Type, bool>> properties =
dataTypeDescriptor.Fields.
Select(f => new Tuple<string, Type, bool>(f.Name, f.InstanceType, f.IsReadOnly)).
Concat(new[] { new Tuple<string, Type, bool>("DataSourceId", typeof(DataSourceId), true) });
return CreateCodeTypeDeclaration(fullName, properties);
}
示例6: GetEmptyDataClassType
/// <summary>
/// This method will return the type of the empty data class type.
/// If the type does not exist, one will be runtime code generated
/// using the <paramref name="dataTypeDescriptor"/>.
/// </summary>
/// <param name="dataTypeDescriptor">
/// The data type descriptor for the data type to get
/// the empty class type for.
/// </param>
/// <param name="forceReCompilation">
/// If this is true a new empty class will be
/// compiled at runtime regardless if it exists or not.
/// Use with caution!
/// </param>
/// <returns>The empty class type for the given data interface type.</returns>
public static Type GetEmptyDataClassType(DataTypeDescriptor dataTypeDescriptor, bool forceReCompilation = false)
{
if (!string.IsNullOrEmpty(dataTypeDescriptor.BuildNewHandlerTypeName))
{
return GetEmptyClassFromBuildNewHandler(dataTypeDescriptor);
}
if (forceReCompilation)
{
return CreateEmptyDataClassType(dataTypeDescriptor);
}
Type interfaceType = TypeManager.TryGetType(dataTypeDescriptor.GetFullInterfaceName());
string emptyClassFullName = EmptyDataClassCodeGenerator.GetEmptyClassTypeFullName(dataTypeDescriptor);
Type emptyClassType = TypeManager.TryGetType(emptyClassFullName);
bool isRecompileNeeded = true;
if (interfaceType != null)
{
isRecompileNeeded = CodeGenerationManager.IsRecompileNeeded(interfaceType, new[] { emptyClassType });
}
if (isRecompileNeeded)
{
lock (_lock)
{
interfaceType = TypeManager.TryGetType(dataTypeDescriptor.GetFullInterfaceName());
emptyClassType = TypeManager.TryGetType(emptyClassFullName);
if (interfaceType != null)
{
isRecompileNeeded = CodeGenerationManager.IsRecompileNeeded(interfaceType, new[] { emptyClassType });
}
if (isRecompileNeeded)
{
emptyClassType = CreateEmptyDataClassType(dataTypeDescriptor);
}
}
}
return emptyClassType;
}
示例7: GenerateTableName
internal static string GenerateTableName(DataTypeDescriptor dataTypeDescriptor, DataScopeIdentifier dataScope, CultureInfo cultureInfo)
{
string tableName = dataTypeDescriptor.GetFullInterfaceName().Replace('.', '_');
switch (dataScope.Name)
{
case DataScopeIdentifier.PublicName:
break;
case DataScopeIdentifier.AdministratedName:
tableName += "_Unpublished";
break;
default:
throw new InvalidOperationException("Unsupported data scope identifier: '{0}'".FormatWith(dataScope.Name));
}
if (!cultureInfo.Name.IsNullOrEmpty())
{
tableName += "_" + cultureInfo.Name.Replace('-', '_').Replace(' ', '_');
}
return tableName;
}
示例8: GetTempFileName
private static string GetTempFileName(DataTypeDescriptor typeDescriptor)
{
string folderPath = PathUtil.Resolve(GlobalSettingsFacade.GeneratedAssembliesDirectory);
string filePath = Path.Combine(folderPath, typeDescriptor.GetFullInterfaceName() + ".cs");
if (filePath.Length > 255)
{
filePath = Path.Combine(folderPath, typeDescriptor.DataTypeId + ".cs");
}
return filePath;
}
示例9: GetEmptyClassTypeFullName
internal static string GetEmptyClassTypeFullName(DataTypeDescriptor dataTypeDescriptor)
{
return NamespaceName + "." + CreateClassName(dataTypeDescriptor.GetFullInterfaceName());
}
示例10: MakeWrapperClassName
internal static string MakeWrapperClassName(DataTypeDescriptor dataTypeDescriptor)
{
return string.Format("{0}Wrapper", dataTypeDescriptor.GetFullInterfaceName().Replace('.', '_').Replace('+', '_'));
}
示例11: MakeNiceTypeFullName
private static string MakeNiceTypeFullName(DataTypeDescriptor dataTypeDescriptor)
{
return dataTypeDescriptor.GetFullInterfaceName().Replace('.', '_').Replace('+', '_');
}