Exemplo n.º 1
0
        private static Type CreateDerivedType(ModuleBuilder moduleBuilder, ExtendedTable extendedTable, ExtendedType extendedType)
        {
            // TODO: fix
            string randomString = Guid.NewGuid().ToString().Split(new char[] { '-' })[0];
            var typeBuilder = moduleBuilder.DefineType(extendedType.BaseType.Name + randomString, TypeAttributes.Class | TypeAttributes.Public, extendedType.BaseType);

            foreach (var extendedProperty in extendedTable.ExtendedProperties)
            {
                AddProperty(typeBuilder, extendedType.BaseType, extendedProperty.PropertyName, extendedProperty.PropertyType);
            }

            return typeBuilder.CreateType();
        }
Exemplo n.º 2
0
        private static Type CreateDerivedType(ModuleBuilder moduleBuilder, ExtendedTable extendedTable, ExtendedType extendedType)
        {
            // TODO: fix
            string randomString = Guid.NewGuid().ToString().Split(new char[] { '-' })[0];
            var    typeBuilder  = moduleBuilder.DefineType(extendedType.BaseType.Name + randomString, TypeAttributes.Class | TypeAttributes.Public, extendedType.BaseType);

            foreach (var extendedProperty in extendedTable.ExtendedProperties)
            {
                AddProperty(typeBuilder, extendedType.BaseType, extendedProperty.PropertyName, extendedProperty.PropertyType);
            }

            return(typeBuilder.CreateType());
        }