Exemplo n.º 1
0
        void LoadAssembly()
        {
            try
            {
                Assembly wAssembly = new Assembly(_StorageFactory.StorageObject.AssemblyPath);
                Fwk.Bases.ServiceConfiguration           s    = null;
                Fwk.Bases.ServiceConfigurationCollection list = new Fwk.Bases.ServiceConfigurationCollection();
                lblFileName.Text = _StorageFactory.StorageObject.AssemblyPath;

                foreach (AssemblyClass wAssemblyClass in wAssembly.ClassCollections)
                {
                    if (wAssemblyClass.BaseType != null)
                    {
                        if (wAssemblyClass.BaseType.Name.Contains("BusinessService"))
                        {
                            if (!Services.Exists(p => p.Name.Equals(wAssemblyClass.Name.Trim())))
                            {
                                s = new Fwk.Bases.ServiceConfiguration();
                                //Service name
                                s.Name    = wAssemblyClass.Name;
                                s.Handler = wAssemblyClass.FullyQualifiedName;
                                //Request
                                s.Request = wAssemblyClass.Methods[0].Parameters[0].ParameterType.AssemblyQualifiedName;

                                //Response
                                s.Response = wAssemblyClass.Methods[0].ReturnType.AssemblyQualifiedName;

                                list.Add(s);
                            }
                        }
                    }
                }

                var ordenedList = from x in list orderby x.Name select x;
                serviceConfigurationCollectionBindingSource.DataSource = ordenedList;
            }
            catch (System.Reflection.ReflectionTypeLoadException rx)
            {
                base.ExceptionViewer.Show(rx.LoaderExceptions, "Service Management:. Loading assembly");
                _StorageFactory.Clear();
            }
            catch (Exception ex)
            {
                base.ExceptionViewer.Show(ex);
                _StorageFactory.StorageObject.AssemblyPath = string.Empty;
                _StorageFactory.Save();
            }
        }
Exemplo n.º 2
0
        void LoadAssembly()
        {
            try
            {
                if (!System.IO.File.Exists(ControllerTest.Storage.StorageObject.AssemblyPath))
                {
                    return;
                }
                Assembly wAssembly = new Assembly(ControllerTest.Storage.StorageObject.AssemblyPath);
                Fwk.Bases.ServiceConfiguration           wServiceConfiguration = null;
                Fwk.Bases.ServiceConfigurationCollection list = new Fwk.Bases.ServiceConfigurationCollection();
                lblFileName.Text = ControllerTest.Storage.StorageObject.AssemblyPath;

                foreach (AssemblyClass wAssemblyClass in wAssembly.ClassCollections)
                {
                    if (wAssemblyClass.BaseType != null)
                    {
                        if (wAssemblyClass.BaseType.Name.Contains("BusinessService"))
                        {
                            wServiceConfiguration = new Fwk.Bases.ServiceConfiguration();
                            //Service name
                            wServiceConfiguration.Name    = wAssemblyClass.Name;
                            wServiceConfiguration.Handler = wAssemblyClass.FullyQualifiedName;
                            //Request
                            wServiceConfiguration.Request = wAssemblyClass.Methods[0].Parameters[0].ParameterType.AssemblyQualifiedName;

                            //Response
                            wServiceConfiguration.Response = wAssemblyClass.Methods[0].ReturnType.AssemblyQualifiedName;

                            list.Add(wServiceConfiguration);
                        }
                    }
                }

                serviceConfigurationCollectionBindingSource.DataSource = list.OrderBy(p => p.Name);
            }
            catch (System.Reflection.ReflectionTypeLoadException rx)
            {
                base.ExceptionViewer.Show(rx.LoaderExceptions, "Service Management:. Loading assembly");
                //ControllerTest.Storage.Clear();
            }
            catch (Exception ex)
            {
                base.ExceptionViewer.Show(ex);
                //ControllerTest.Storage.Clear();
            }
        }
Exemplo n.º 3
0
        void LoadAssembly()
        {

            try
            {
                Assembly wAssembly = new Assembly(_StorageFactory.StorageObject.AssemblyPath);
                Fwk.Bases.ServiceConfiguration s = null;
                Fwk.Bases.ServiceConfigurationCollection list = new Fwk.Bases.ServiceConfigurationCollection();
                lblFileName.Text = _StorageFactory.StorageObject.AssemblyPath;

                foreach (AssemblyClass wAssemblyClass in wAssembly.ClassCollections)
                {
                    if (wAssemblyClass.BaseType != null)
                    {
                        if (wAssemblyClass.BaseType.Name.Contains("BusinessService"))
                        {
                            if (!Services.Exists(p => p.Name.Equals(wAssemblyClass.Name.Trim())))
                            {
                                s = new Fwk.Bases.ServiceConfiguration();
                                //Service name
                                s.Name = wAssemblyClass.Name;
                                s.Handler = wAssemblyClass.FullyQualifiedName;
                                //Request
                                s.Request = wAssemblyClass.Methods[0].Parameters[0].ParameterType.AssemblyQualifiedName;

                                //Response
                                s.Response = wAssemblyClass.Methods[0].ReturnType.AssemblyQualifiedName;

                                list.Add(s);
                            }
                        }
                    }
                }

                var ordenedList = from x in list orderby x.Name select x;
                serviceConfigurationCollectionBindingSource.DataSource = ordenedList;
            }
            catch (System.Reflection.ReflectionTypeLoadException rx)
            {
                base.ExceptionViewer.Show(rx.LoaderExceptions, "Service Management:. Loading assembly");
                _StorageFactory.Clear();
            }
            catch (Exception ex)
            {

                base.ExceptionViewer.Show(ex);
                _StorageFactory.StorageObject.AssemblyPath = string.Empty;
                _StorageFactory.Save();
            }
        }
Exemplo n.º 4
0
        void LoadAssembly()
        {
           
            try
            {
                if (!System.IO.File.Exists(ControllerTest.Storage.StorageObject.AssemblyPath))
                    return;
                Assembly wAssembly = new Assembly(ControllerTest.Storage.StorageObject.AssemblyPath);
                Fwk.Bases.ServiceConfiguration wServiceConfiguration = null;
                Fwk.Bases.ServiceConfigurationCollection list = new Fwk.Bases.ServiceConfigurationCollection();
                lblFileName.Text = ControllerTest.Storage.StorageObject.AssemblyPath;

                foreach (AssemblyClass wAssemblyClass in wAssembly.ClassCollections)
                {
                    if (wAssemblyClass.BaseType != null)
                    {
                        if (wAssemblyClass.BaseType.Name.Contains("BusinessService"))
                        {
                            wServiceConfiguration = new Fwk.Bases.ServiceConfiguration();
                            //Service name
                            wServiceConfiguration.Name = wAssemblyClass.Name;
                            wServiceConfiguration.Handler = wAssemblyClass.FullyQualifiedName;
                            //Request
                            wServiceConfiguration.Request = wAssemblyClass.Methods[0].Parameters[0].ParameterType.AssemblyQualifiedName;

                            //Response
                            wServiceConfiguration.Response = wAssemblyClass.Methods[0].ReturnType.AssemblyQualifiedName;

                            list.Add(wServiceConfiguration);
                        }
                    }
                }

                serviceConfigurationCollectionBindingSource.DataSource = list.OrderBy (p=> p.Name );
            }
            catch (System.Reflection.ReflectionTypeLoadException rx)
            {
                base.ExceptionViewer.Show(rx.LoaderExceptions, "Service Management:. Loading assembly");
                //ControllerTest.Storage.Clear();
            }
            catch (Exception ex)
            {

                base.ExceptionViewer.Show(ex);
                //ControllerTest.Storage.Clear();
            }
        }