public IList SendRequest(string request)
        {
            AppDomain domain = AppDomain.CreateDomain("ModelDomain");

            try
            {
                Proxy        proxy        = (Proxy)domain.CreateInstanceAndUnwrap("Proxy", "Sofia.Core.Proxy");
                ModelRequest modelRequest = proxy.LoadModel(modelName + ".dll", request);
                return(modelRequest.Result);
            }
            finally
            {
                AppDomain.Unload(domain);
            }
        }
Exemple #2
0
        public ModelRequest LoadModel(string assemblyFilename, string request)
        {
            Assembly Dynamic = Assembly.LoadFrom(assemblyFilename);

            Type TypeofIModel = typeof(IModel);
            foreach (Type Exported in Dynamic.GetExportedTypes())
                if (TypeofIModel.IsAssignableFrom(Exported))
                {
                    ConstructorInfo Constructor = Exported.GetConstructor(Type.EmptyTypes);
                    if (Constructor != null)
                    {
                        IModel instance = (IModel) Constructor.Invoke(null);
                        ModelRequest modelRequest = new ModelRequest(instance, request);
                        return modelRequest;
                    }
                }
            // if no matches
            return null;
        }
Exemple #3
0
        public ModelRequest LoadModel(string assemblyFilename, string request)
        {
            Assembly Dynamic = Assembly.LoadFrom(assemblyFilename);

            Type TypeofIModel = typeof(IModel);

            foreach (Type Exported in Dynamic.GetExportedTypes())
            {
                if (TypeofIModel.IsAssignableFrom(Exported))
                {
                    ConstructorInfo Constructor = Exported.GetConstructor(Type.EmptyTypes);
                    if (Constructor != null)
                    {
                        IModel       instance     = (IModel)Constructor.Invoke(null);
                        ModelRequest modelRequest = new ModelRequest(instance, request);
                        return(modelRequest);
                    }
                }
            }
            // if no matches
            return(null);
        }