Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
using System;
using System.Linq;
namespace DP_perf_1
{
using System.Data;
using System.Diagnostics;
using System.ServiceModel;
using System.Web;
using System.Windows;
using System.Windows.Forms;
using System.Xml;
using Castle.DynamicProxy;
class Program
{
static void Main(string[] args)
{
var generator = new ProxyGenerator(new PersistentProxyBuilder());
int i = 0;
var types = typeof(object).Assembly.GetTypes()
.Union(typeof(Uri).Assembly.GetTypes())
.Union(typeof(DataSet).Assembly.GetTypes())
.Union(typeof(Form).Assembly.GetTypes())
.Union(typeof(AspNetHostingPermission).Assembly.GetTypes())
.Union(typeof(IHasXmlNode).Assembly.GetTypes())
.Union(typeof(ICommunicationObject).Assembly.GetTypes())
.Union(typeof(DependencyPropertyHelper).Assembly.GetTypes())
.Where(t => t.IsVisible && t.IsInterface && !t.IsGenericTypeDefinition).ToList();;
var sw = Stopwatch.StartNew();
foreach (var type in types)
{
var target = generator.CreateInterfaceProxyWithoutTarget(type);
i++;
target.GetType();
}
sw.Stop();
Console.WriteLine("Number of types proxied: {0}", i);
Console.WriteLine("Time taken {0}",sw.Elapsed);
Console.WriteLine("Total number of generated types {0}",
generator.ProxyBuilder.ModuleScope.ObtainDynamicModuleWithStrongName().GetTypes().Length);
Console.ReadKey(true);
generator.ProxyBuilder.ModuleScope.SaveAssembly();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.