Click here to Skip to main content
15,894,186 members
Articles / Desktop Programming / WPF

General DynamicObject Proxy and Fast Reflection Proxy

Rate me:
Please Sign up or sign in to vote.
5.00/5 (8 votes)
15 Sep 2010CPOL5 min read 42.3K   645   32  
Extending functionality by wrapping entity using DynamicObject. Improving performance of Reflection by using cache and expressions
using System;
using System.Reflection;
using SysBits.Reflection;

namespace SysBits.DynamicProxies
{
	internal class FullAccessProxy : DynamicProxy
	{
		public FullAccessProxy(object o, Type forceType = null) : base(new ReflectionProxy(o, true, forceType)) { }

		private FullAccessProxy(IStaticProxy proxy) : base(proxy) { }

		/// <summary>
		/// 	Create an instance via the constructor matching the args
		/// </summary>
		public static dynamic FromType(Assembly asm, string typeName, params object[] args)
		{
			var proxy = ReflectionProxy.FromType(true, asm, typeName, args);
			if (proxy == null) return null;
			return new FullAccessProxy(proxy);
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Israel Israel
Yury is Software Engineer since 1988.
His programming experience includes C#/VB.NET, WPF, C/C++(MFC/STL), Borland Delphi & C++ (VCL), JavaScript, HTML, CSS, XML, SQL, VB6, DirectX, Flash.
He has worked on PCs (DOS/Win3.1-Vista) and PocketPCs (WinCE).

Yury was born in Ukraine, but currently based in Jerusalem.

Comments and Discussions