예제 #1
0
            public object BuildObject(LiteApiServiceResolver serviceResolver)
            {
                var parameters = new object[_constructorParamTypes.Length];

                for (int i = 0; i < parameters.Length; i++)
                {
                    parameters[i] = serviceResolver.Resolve(_constructorParamTypes[i]);
                }
                return(_constructorInfo.Invoke(parameters));
            }
예제 #2
0
            public object GetService(LiteApiServiceResolver serviceResolver)
            {
                if (Factory != null)
                {
                    return(Factory());
                }

                if (IsSingleton)
                {
                    if (SingletonInstance == null)
                    {
                        SingletonInstance = BuildObject(serviceResolver);
                    }
                    return(SingletonInstance);
                }

                return(BuildObject(serviceResolver));
            }