BuildYourOwnDAL.LazyLoadingInterceptor.Intercept C# (CSharp) Method

Intercept() public method

public Intercept ( IInvocation invocation ) : void
invocation IInvocation
return void
        public void Intercept(IInvocation invocation)
        {
            if (invocation.Method.Name.Equals("get_" + tableInfo.PrimaryKey.PropertyInfo.Name) ||
                invocation.Method.Name.Equals("set_" + tableInfo.PrimaryKey.PropertyInfo.Name))
            {
                invocation.Proceed();
                return;
            }

            if (needsToBeInitialized)
            {
                needsToBeInitialized = false;
                session.InitializeProxy(invocation.Proxy, invocation.TargetType);
            }

            invocation.Proceed();
        }