Ejemplo n.º 1
0
        public object CreateResourceModel(IResourceIdentifier resource)
        {
            if (resource == null)
            {
                return(null);
            }

            var type = ModelRegistry.GetModelType(resource.Type);

            Log.Debug(() => $"activating session-managed instance of {type.FullName}:{{{resource.Id}}}");
            var model      = Activator.CreateInstance(type);
            var initialize = type.GetInitializeMethod();

            initialize.Invoke(model, new object[] { resource, this });
            return(model);
        }