コード例 #1
0
        internal static Type GetFileBuilderNewHandler(Type dataType)
        {
            Type result;

            if (!_fileBuildNewHandlerTypes.TryGetValue(dataType, out result))
            {
                lock (_lock)
                {
                    if (!_fileBuildNewHandlerTypes.TryGetValue(dataType, out result))
                    {
                        DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(dataType);

                        string fullName = EmptyDataClassCodeGenerator.GetEmptyClassTypeFullName(dataTypeDescriptor);

                        result = TypeManager.TryGetType(fullName);

                        if (result == null)
                        {
                            CodeAttributeDeclaration codeAttributeDeclaration = new CodeAttributeDeclaration(
                                new CodeTypeReference(typeof(FileStreamManagerAttribute)),
                                new [] {
                                new CodeAttributeArgument(new CodeTypeOfExpression(typeof(IFileEmptyDataClassFileStreamManager)))
                            });

                            result = EmptyDataClassTypeManager.CreateEmptyDataClassType(dataTypeDescriptor, typeof(IFileEmptyDataClassBase), codeAttributeDeclaration);
                        }

                        _fileBuildNewHandlerTypes.Add(dataType, result);
                    }
                }
            }

            return(result);
        }
コード例 #2
0
 /// <summary>
 /// Gets the runtime empty data type for the given data type descriptor.
 /// </summary>
 /// <param name="dataTypeDescriptor"></param>
 /// <returns></returns>
 public static Type GetDataTypeEmptyClass(DataTypeDescriptor dataTypeDescriptor)
 {
     return(EmptyDataClassTypeManager.GetEmptyDataClassType(dataTypeDescriptor, false));
 }
コード例 #3
0
 /// <summary>
 /// Gets the runtime empty data type for the given data type.
 /// </summary>
 /// <param name="dataType"></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></returns>
 public static Type GetDataTypeEmptyClass(Type dataType, bool forceReCompilation = false)
 {
     return(EmptyDataClassTypeManager.GetEmptyDataClassType(dataType, forceReCompilation));
 }