Пример #1
0
        private static object CreateModel(Type type)
        {
            IComponentContainer container = null;

            IServiceProvider sp = Application.Current as IServiceProvider;

            if (sp != null)
            {
                container = (IComponentContainer)sp.GetService(typeof(IComponentContainer));
            }

            if (container != null)
            {
                return(container.GetObject(type));
            }

            return(Activator.CreateInstance(type));
        }