TechTalk Genome v4.2

Proxy Providers

Genome uses proxies to implement data access aspects of the business layer classes. Business objects are accessible through proxies, similar to the way that remotely located objects are accessible through .NET Remoting transparent proxies. The proxies are instances of the proxy classes derived from the business classes. This model requires that business types are declared as abstract classes. Genome implements a factory pattern to create proxy instances. Proxies are created either explicitly by creating new persistent objects or implicitly when existing persistent objects are populated from the database.

The proxy is only required for concrete classes. Note that the term abstract does not correspond to the abstract class modifier in C#, as persistent classes are always declared as abstract. Since Genome uses a factory model to create object instances, an exception is thrown when a concrete type is loaded up or needs to be created without an associated proxy provider.

Fields (member variables) cannot be declared on persistent classes. Transient state can be stored in Context.Session if necessary.

The most commonly used proxy provider in applications is the CodeGeneratedProxy, which generates a proxy class for a persistent type and implements all of its data access aspects. The generation of the proxy class is part of schema compilation and the compiled proxy implementation is part of the schema assembly created by the schema compiler .

Special proxy behavior can be implemented by creating a custom proxy class, for which the <StaticProxy> element has to be used.

See Also

Context | Context.Pin<S> | Context.Unpin<S> | Context.Session | <CodeGeneratedProxy> Element | <StaticProxy> Element