How to create new Context instance

Coordinator
May 22, 2014 at 9:30 PM
Edited May 22, 2014 at 9:32 PM
Hi,

for creating new Context instances just derive from the Context class; for example:
        public class MyContext : Context {

            public MyContext() {
                this.Cache = new Cache();
                this.Configuration = new Configuration();
                
                this.Configuration.CheckIgnoreMemberFunc = global::SIT.Components.ObjectComparer.Configuration.Default.CheckIgnoreMember;
                this.Configuration.CheckStopRecursionFunc = global::SIT.Components.ObjectComparer.Configuration.Default.CheckStopRecursionFunc;
                this.Configuration.GetMemberBindingFlags = global::SIT.Components.ObjectComparer.Configuration.Default.GetMemberBindingFlags;
                this.Configuration.MetadataRetrievalOptions = MetadataRetrievalOptions.ReflectCompareAttributes;

                this.MetadataReader = new MetadataReaderReflectComapreAttributes(this);

            }

        }
and then just use your newly created class:
//Instead of:
Context ctx = Context.Default;

//... use your class:
Context ctx = new MyContext();