示例#1
0
        private static void Execute(string dllFile, Assembly asm = null)
        {
            string currentPath = Path.GetDirectoryName(dllFile);

            string newName = Path.GetFileNameWithoutExtension(dllFile) + ".EntityProxy.dll";
            string outFile = Path.Combine(currentPath, newName);

            if (File.Exists(outFile))
            {
                File.Delete(outFile);
            }

            if (asm == null)
            {
                asm = Assembly.LoadFrom(dllFile);
            }

            Type[] entityTypes = ProxyBuilder.GetAssemblyEntityTypes(asm);
            if (entityTypes == null || entityTypes.Length == 0)
            {
                return;
            }

            ProxyBuilder.Compile(entityTypes, outFile);

            Console.WriteLine("成功生成实体代理程序集:" + outFile);
        }
示例#2
0
        private static void Execute(string entityDllFile)
        {
            string currentPath = Path.GetDirectoryName(entityDllFile);

            if (string.IsNullOrEmpty(currentPath))
            {
                currentPath = AppDomain.CurrentDomain.BaseDirectory;
            }


            string newName = Path.GetFileNameWithoutExtension(entityDllFile) + ".EntityProxy.dll";
            string outFile = Path.Combine(currentPath, newName);

            if (File.Exists(outFile))
            {
                File.Delete(outFile);
            }

            // 设置当前路径
            Environment.CurrentDirectory = currentPath;

            Assembly asm = Assembly.LoadFile(entityDllFile);

            Type[] entityTypes = ProxyBuilder.GetAssemblyEntityTypes(asm);

            ProxyBuilder.Compile(entityTypes, outFile);
        }