Example #1
0
        static void Main()
        {
#if EASYTEST
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached;
            if (Tracing.GetFileLocationFromSettings() == DevExpress.Persistent.Base.FileLocation.CurrentUserApplicationDataFolder)
            {
                Tracing.LocalUserAppDataPath = Application.LocalUserAppDataPath;
            }
            Tracing.Initialize();
            P3TEKWindowsFormsApplication winApplication = new P3TEKWindowsFormsApplication();
            // Refer to the https://documentation.devexpress.com/eXpressAppFramework/CustomDocument112680.aspx help article for more details on how to provide a custom splash form.
            //winApplication.SplashScreen = new DevExpress.ExpressApp.Win.Utils.DXSplashScreen("YourSplashImage.png");
            SecurityAdapterHelper.Enable();
            try {
                string                   connectionString = "net.tcp://127.0.0.1:1451/DataServer";
                WcfSecuredClient         wcfSecuredClient = new WcfSecuredClient(WcfDataServerHelper.CreateNetTcpBinding(), new EndpointAddress(connectionString));
                MiddleTierClientSecurity security         = new MiddleTierClientSecurity(wcfSecuredClient);
                security.IsSupportChangePassword = true;
                winApplication.Security          = security;
                winApplication.CreateCustomObjectSpaceProvider += (s, e) => {
                    e.ObjectSpaceProviders.Add(new MiddleTierServerObjectSpaceProvider(wcfSecuredClient));
                    e.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(winApplication.TypesInfo, null));
                };
                winApplication.Setup();
                winApplication.Start();
                wcfSecuredClient.Dispose();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
        static void AddKnownTypesFor <T>(ITypesInfo typesInfo)
        {
            var typeInfos = typesInfo.FindTypeInfo <T>().Implementors;
            var types     = typeInfos.Where(info => !info.IsAbstract).Select(info => info.Type).Where(type => type.IsSerializable && !type.IsInterface);

            foreach (var type in types)
            {
                WcfDataServerHelper.AddKnownType(type);
            }
        }
Example #3
0
        static void Main()
        {
            try {
                string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

                ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition();

                Console.WriteLine(@"Starting...");


                var serverApplication = new ConsoleApplicationServerServerApplication(new SecurityStrategyComplex(typeof(SecuritySystemUser), typeof(SecuritySystemRole), new AuthenticationStandard()))
                {
                    ConnectionString = connectionString
                };
                Console.WriteLine(@"Setup...");
                var worldCreatorTypeInfoSource = WorldCreatorTypeInfoSource.Instance;
                serverApplication.Setup();
                Console.WriteLine(@"CheckCompatibility...");
                serverApplication.CheckCompatibility();
                XpandWcfDataServerHelper.AddKnownTypesForAll(serverApplication);
                serverApplication.Dispose();

                Console.WriteLine(@"Starting server...");
                IDataServerSecurity SecurityProviderHandler() => new SecurityStrategyComplex(typeof(SecuritySystemUser), typeof(SecuritySystemRole), new AuthenticationStandard());

                var dataServer = new XpandSecuredDataServer(connectionString, XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary, SecurityProviderHandler);

                var serviceHost    = new ServiceHost(new WcfSecuredDataServer(dataServer));
                var defaultBinding = (WSHttpBinding)WcfDataServerHelper.CreateDefaultBinding();
                defaultBinding.ReaderQuotas.MaxStringContentLength = 2147483647;
                serviceHost.AddServiceEndpoint(typeof(IWcfSecuredDataServer), defaultBinding, "http://*****:*****@"Server is started. Press Enter to stop.");
                Console.ReadLine();
                Console.WriteLine(@"Stopping...");
                serviceHost.Close();
                Console.WriteLine(@"Server is stopped.");
            } catch (Exception e) {
                Console.WriteLine(@"Exception occurs: " + e.Message);
                Console.WriteLine(@"Press Enter to close.");
                Console.ReadLine();
            }
        }
        static void Main(string[] args)
        {
            CustomWcfSecuredClient wcfSecuredClient = new CustomWcfSecuredClient(
                WcfDataServerHelper.CreateNetTcpBinding(), new EndpointAddress("net.tcp://localhost:1424/DataServer"));

            Console.WriteLine("Login as 'User' user");
            wcfSecuredClient.GetSecurityStrategyInfo();
            wcfSecuredClient.Logon("User", "");
            AccessEmployee(wcfSecuredClient);
            wcfSecuredClient.Logoff();

            Console.WriteLine("\nLogin as 'Admin' user");
            wcfSecuredClient.GetSecurityStrategyInfo();
            wcfSecuredClient.Logon("Admin", "");
            AccessEmployee(wcfSecuredClient);
            wcfSecuredClient.Logoff();

            Console.WriteLine("\nPress Enter to close...");
            Console.ReadLine();
        }
Example #5
0
        static void Main()
        {
#if EASYTEST
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = Debugger.IsAttached;
            var winApplication = new SecuritySystemExampleWindowsFormsApplication();
            try {
                winApplication.ConnectionString = "http://localhost:1451/DataServer";
                XpandWcfDataServerHelper.AddKnownTypes();
                var defaultBinding = (WSHttpBinding)WcfDataServerHelper.CreateDefaultBinding();
                defaultBinding.ReaderQuotas.MaxStringContentLength = 2147483647;
                var clientDataServer = new WcfSecuredDataServerClient(
                    defaultBinding,
                    new EndpointAddress(winApplication.ConnectionString));
                var securityClient = new ServerSecurityClient(clientDataServer, new ClientInfoFactory())
                {
                    IsSupportChangePassword = true
                };
                winApplication.ApplicationName = "SecuritySystemExample";
                winApplication.Security        = securityClient;
                winApplication.CreateCustomObjectSpaceProvider +=
                    delegate(object sender, CreateCustomObjectSpaceProviderEventArgs e) {
                    e.ObjectSpaceProvider = new DataServerObjectSpaceProvider(clientDataServer, securityClient);
                };

                winApplication.UseOldTemplates = false;
                var worldCreatorTypeInfoSource = WorldCreatorTypeInfoSource.Instance;
                winApplication.Setup();
                winApplication.Start();
                clientDataServer.Close();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
Example #6
0
        static void Main()
        {
            try {
                Console.WriteLine("Starting...");
                ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition();
                XpoTypesInfoHelper.GetXpoTypeInfoSource();
                XafTypesInfo.Instance.RegisterEntity(typeof(Employee));
                XafTypesInfo.Instance.RegisterEntity(typeof(PermissionPolicyUser));
                XafTypesInfo.Instance.RegisterEntity(typeof(PermissionPolicyRole));
                string connectionString = @"Integrated Security=SSPI;Pooling=false;Data Source=(localdb)\mssqllocaldb;Initial Catalog=ClientServer";
                Console.WriteLine("Creating default objects...");
                XPObjectSpaceProvider objectSpaceProvider = new XPObjectSpaceProvider(connectionString);
                objectSpaceProvider.CheckCompatibilityType = CheckCompatibilityType.DatabaseSchema;
                objectSpaceProvider.SchemaUpdateMode       = SchemaUpdateMode.DatabaseAndSchema;
                IObjectSpace objectSpace = objectSpaceProvider.CreateUpdatingObjectSpace(true);
                CreateUsers(objectSpace);
                CreateObjects(objectSpace);
                objectSpace.CommitChanges();

                Console.WriteLine("Starting server...");
                Func <IDataServerSecurity> securityProviderHandler = () => new SecurityStrategyComplex(typeof(PermissionPolicyUser), typeof(PermissionPolicyRole), new AuthenticationStandard());

                ServiceHost serviceHost = new WcfXafServiceHost(connectionString, securityProviderHandler);
                serviceHost.AddServiceEndpoint(typeof(IWcfXafDataServer), WcfDataServerHelper.CreateNetTcpBinding(), "net.tcp://localhost:1424/DataServer");
                serviceHost.Open();

                Console.WriteLine("Server is started. Press Enter to stop.");
                Console.ReadLine();
                Console.WriteLine("Stopping...");
                serviceHost.Close();
                Console.WriteLine("Server is stopped.");
            }
            catch (Exception e) {
                Console.WriteLine("Exception occurs: " + e.Message);
                Console.WriteLine("Press Enter to close.");
                Console.ReadLine();
            }
        }
Example #7
0
        protected void Session_Start(Object sender, EventArgs e)
        {
            WebApplication.SetInstance(Session, new PermissionPolicyExampleAspNetApplication());
            string connectionString = "net.tcp://127.0.0.1:1451/DataServer";
            WcfSecuredDataServerClient clientDataServer = new WcfSecuredDataServerClient(
                WcfDataServerHelper.CreateDefaultBinding(), new EndpointAddress(connectionString));

            Session["DataServerClient"] = clientDataServer;
            WcfSecuredClient         wcfSecuredClient = new WcfSecuredClient(WcfDataServerHelper.CreateNetTcpBinding(), new EndpointAddress(connectionString));
            MiddleTierClientSecurity security         = new MiddleTierClientSecurity(wcfSecuredClient);

            security.IsSupportChangePassword           = true;
            WebApplication.Instance.ApplicationName    = "PermissionPolicyExample";
            WebApplication.Instance.Security           = security;
            WebApplication.Instance.DatabaseUpdateMode = DatabaseUpdateMode.Never;
            WebApplication.Instance.CreateCustomObjectSpaceProvider +=
                delegate(object sender2, CreateCustomObjectSpaceProviderEventArgs e2)
            {
                e2.ObjectSpaceProvider = new MiddleTierServerObjectSpaceProvider(wcfSecuredClient);
            };
            WebApplication.Instance.Setup();
            WebApplication.Instance.Start();
        }
Example #8
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached;
            SecuredExportExampleWindowsFormsApplication winApplication = new SecuredExportExampleWindowsFormsApplication();

#if EASYTEST
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
            var serverProcess = new System.Diagnostics.Process();
            serverProcess.StartInfo.FileName = @"..\..\..\SecuredExportExample.MiddleTierSecurityServer\bin\EasyTest\SecuredExportExample.MiddleTierSecurityServer.exe";
            serverProcess.Start();
            System.Threading.Thread.Sleep(5000);
#endif
            try
            {
                WcfDataServerHelper.AddKnownType(typeof(ExportPermissionRequest));
                winApplication.ConnectionString   = "net.tcp://127.0.0.1:1451/DataServer";
                winApplication.DatabaseUpdateMode = DatabaseUpdateMode.Never;
                WcfSecuredClient         wcfSecuredClient = new WcfSecuredClient(WcfDataServerHelper.CreateNetTcpBinding(), new EndpointAddress(winApplication.ConnectionString));
                MiddleTierClientSecurity securityClient   = new MiddleTierClientSecurity(wcfSecuredClient);
                securityClient.IsSupportChangePassword = true;
                winApplication.ApplicationName         = "SecuredExportExample";
                winApplication.Security = securityClient;
                winApplication.CreateCustomObjectSpaceProvider += (s, e) =>
                {
                    e.ObjectSpaceProvider = new MiddleTierServerObjectSpaceProvider(wcfSecuredClient);
                };
                winApplication.Setup();
                winApplication.Start();
                wcfSecuredClient.Dispose();
            }
            catch (Exception e)
            {
                winApplication.HandleException(e);
            }
        }
Example #9
0
        static void Main(string[] args)
        {
            try
            {
                string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

                ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition();

                ServerApplication serverApplication = new ServerApplication();
                serverApplication.ApplicationName        = "BPIWABK";
                serverApplication.CheckCompatibilityType = CheckCompatibilityType.DatabaseSchema;
                if (System.Diagnostics.Debugger.IsAttached && serverApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema)
                {
                    serverApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
                }

                serverApplication.Modules.BeginInit();
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Security.SecurityModule());
                serverApplication.Modules.Add(new BPIWABK.Module.BPIWABKModule());
                serverApplication.Modules.Add(new BPIWABK.Module.Win.BPIWABKWindowsFormsModule());
                serverApplication.Modules.Add(new BPIWABK.Module.Web.BPIWABKAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.AuditTrail.AuditTrailModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Objects.BusinessClassLibraryCustomizationModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.ChartModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.Win.ChartWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.Web.ChartAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.CloneObject.CloneObjectModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ConditionalAppearance.ConditionalAppearanceModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.DashboardsModule()
                {
                    DashboardDataType = typeof(DevExpress.Persistent.BaseImpl.DashboardData)
                });
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.Win.DashboardsWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.Web.DashboardsAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.FileAttachments.Win.FileAttachmentsWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.FileAttachments.Web.FileAttachmentsAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.HtmlPropertyEditor.Win.HtmlPropertyEditorWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.HtmlPropertyEditor.Web.HtmlPropertyEditorAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.PivotChartModuleBase());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.Win.PivotChartWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.Web.PivotChartAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.PivotGridModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.Win.PivotGridWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.Web.PivotGridAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.ReportsModuleV2()
                {
                    ReportDataType = typeof(DevExpress.Persistent.BaseImpl.ReportDataV2)
                });
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.Win.ReportsWindowsFormsModuleV2());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.Web.ReportsAspNetModuleV2());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.TreeListEditorsModuleBase());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.Win.TreeListEditorsWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.Web.TreeListEditorsAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.ValidationModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Win.ValidationWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Web.ValidationAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ViewVariantsModule.ViewVariantsModule());
                serverApplication.Modules.EndInit();

                serverApplication.DatabaseVersionMismatch         += new EventHandler <DatabaseVersionMismatchEventArgs>(serverApplication_DatabaseVersionMismatch);
                serverApplication.CreateCustomObjectSpaceProvider += new EventHandler <CreateCustomObjectSpaceProviderEventArgs>(serverApplication_CreateCustomObjectSpaceProvider);

                serverApplication.ConnectionString = connectionString;

                Console.WriteLine("Mempersiapkan...");
                serverApplication.Setup();
                Console.WriteLine("Memeriksa kompatibilitas...");
                serverApplication.CheckCompatibility();
                serverApplication.Dispose();
                WcfDataServerHelper.AddKnownType(typeof(ExportPermissionRequest));
                Console.WriteLine("Memulai layanan...");
                //ServerPermissionPolicyRequestProcessor.UseAutoAssociationPermission = true;
                QueryRequestSecurityStrategyHandler securityProviderHandler = delegate()
                {
                    SecurityStrategyComplex security = new SecurityStrategyComplex(
                        typeof(Pegawai), typeof(Peran), new AuthenticationStandard());
                    security.CustomizeRequestProcessors +=
                        delegate(object sender, CustomizeRequestProcessorsEventArgs e)
                    {
                        List <IOperationPermission> result = new List <IOperationPermission>();
                        if (security != null)
                        {
                            Pegawai user = security.User as Pegawai;
                            if (user != null)
                            {
                                foreach (Peran role in user.Roles)
                                {
                                    if (role.CanExport)
                                    {
                                        result.Add(new ExportPermission());
                                    }
                                }
                            }
                        }

                        IPermissionDictionary permissionDictionary = new PermissionDictionary((IEnumerable <IOperationPermission>)result);
                        e.Processors.Add(typeof(ExportPermissionRequest), new ExportPermissionRequestProcessor(permissionDictionary));
                    };
                    return(security);
                };
                SecuredDataServer dataServer = new SecuredDataServer(connectionString, XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary, securityProviderHandler);
                RemoteSecuredDataServer.Initialize(dataServer);

                //"Authentication with the TCP Channel" at http://msdn.microsoft.com/en-us/library/59hafwyt(v=vs.80).aspx

                IDictionary t = new Hashtable();
                t.Add("port", 8082);
                //t.Add("secure", true);
                //t.Add("impersonate", false);

                if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["Test"]) == false)
                {
                    Console.WriteLine("Test");
                }

                TcpChannel channel = new TcpChannel(t, null, null);
                ChannelServices.RegisterChannel(channel, true);
                RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemoteSecuredDataServer), "DataServer", WellKnownObjectMode.Singleton);
                Console.WriteLine("Layanan telah dimulai...");
                Console.WriteLine("");
                Console.WriteLine("PERINGATAN: aplikasi Analisis Beban Kerja tidak dapat digunakan apabila layanan di hentikan!");
                Console.WriteLine("Apabila layanan telah di hentikan, jalankan BPIWABK.Console.exe untuk kembali memulai layanan.");
                Console.WriteLine("Tekan tombol Enter untuk menghentikan layanan.");
                Console.ReadLine();
                Console.WriteLine("Menghetikan...");
                ChannelServices.UnregisterChannel(channel);
                Console.WriteLine("Layanan telah dihentikan.");
            }
            catch (Exception e)
            {
                Console.WriteLine("Kesalahan terjadi: " + e.Message);
                Console.WriteLine("Tekan tombol Enter untuk menutup.");
                Console.ReadLine();
            }
        }
        static void Main(string[] args)
        {
            try {
                ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition();
                InMemoryDataStoreProvider.Register();
                string connectionString = InMemoryDataStoreProvider.ConnectionString;

                Console.WriteLine("Starting...");

                ServerApplication serverApplication = new ServerApplication();
                // Change the ServerApplication.ApplicationName property value. It should be the same as your client application name.
                serverApplication.ApplicationName = "SecuredExportExample";

                // Add your client application's modules to the ServerApplication.Modules collection here.
                serverApplication.Modules.BeginInit();
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Win.SystemModule.SystemWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Security.SecurityModule());
                serverApplication.Modules.Add(new SecuredExportExample.Module.SecuredExportExampleModule());
                serverApplication.Modules.EndInit();

                serverApplication.DatabaseVersionMismatch         += new EventHandler <DatabaseVersionMismatchEventArgs>(serverApplication_DatabaseVersionMismatch);
                serverApplication.CreateCustomObjectSpaceProvider += new EventHandler <CreateCustomObjectSpaceProviderEventArgs>(serverApplication_CreateCustomObjectSpaceProvider);

                serverApplication.ConnectionString = connectionString;

                Console.WriteLine("Setup...");
                serverApplication.Setup();
                Console.WriteLine("CheckCompatibility...");
                serverApplication.CheckCompatibility();
                serverApplication.Dispose();

                Console.WriteLine("Starting server...");
                Func <IDataServerSecurity> dataServerSecurityProvider = () => {
                    SecurityStrategyComplex security = new SecurityStrategyComplex(
                        typeof(Employee), typeof(ExtendedSecurityRole), new AuthenticationStandard());
                    security.CustomizeRequestProcessors +=
                        delegate(object sender, CustomizeRequestProcessorsEventArgs e) {
                        List <IOperationPermission> result = new List <IOperationPermission>();
                        if (security != null)
                        {
                            Employee user = security.User as Employee;
                            if (user != null)
                            {
                                foreach (ExtendedSecurityRole role in user.Roles)
                                {
                                    if (role.CanExport)
                                    {
                                        result.Add(new ExportPermission());
                                    }
                                }
                            }
                        }
                        IPermissionDictionary permissionDictionary = new PermissionDictionary((IEnumerable <IOperationPermission>)result);
                        e.Processors.Add(typeof(ExportPermissionRequest), new ExportPermissionRequestProcessor(permissionDictionary));
                    };
                    return(security);
                };

                WcfDataServerHelper.AddKnownType(typeof(ExportPermissionRequest));
                WcfXafServiceHost serviceHost = new WcfXafServiceHost(connectionString, dataServerSecurityProvider);
                serviceHost.AddServiceEndpoint(typeof(IWcfXafDataServer), WcfDataServerHelper.CreateNetTcpBinding(), "net.tcp://127.0.0.1:1451/DataServer");
                serviceHost.Open();
                Console.WriteLine("Server is started. Press Enter to stop.");
#if !EASYTEST
                Console.ReadLine();
#else
                // 20 seconds is enough to pass all tests:
                System.Threading.Thread.Sleep(20000);
#endif
                Console.WriteLine("Stopping...");
                serviceHost.Close();
                Console.WriteLine("Server is stopped.");
            }
            catch (Exception e) {
                Console.WriteLine("Exception occurs: " + e.Message);
                Console.WriteLine("Press Enter to close.");
                Console.ReadLine();
            }
        }
Example #11
0
        private void initXAFServer()
        {
            string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

            ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition();

            SecurityAdapterHelper.Enable();
            ServerApplication serverApplication = new ServerApplication();

            serverApplication.ApplicationName        = "LogXExplorer";
            serverApplication.CheckCompatibilityType = CheckCompatibilityType.DatabaseSchema;
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached && serverApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema)
            {
                serverApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
            }
#endif

            serverApplication.Modules.BeginInit();
            serverApplication.Modules.Add(new DevExpress.ExpressApp.Security.SecurityModule());
            serverApplication.Modules.Add(new LogXExplorer.Module.LogXExplorerModule());
            serverApplication.Modules.Add(new LogXExplorer.Module.Win.LogXExplorerWindowsFormsModule());
            serverApplication.Modules.Add(new DevExpress.ExpressApp.AuditTrail.AuditTrailModule());
            serverApplication.Modules.Add(new DevExpress.ExpressApp.Objects.BusinessClassLibraryCustomizationModule());
            serverApplication.Modules.Add(new DevExpress.ExpressApp.CloneObject.CloneObjectModule());
            serverApplication.Modules.Add(new DevExpress.ExpressApp.ConditionalAppearance.ConditionalAppearanceModule());
            serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.DashboardsModule()
            {
                DashboardDataType = typeof(DevExpress.Persistent.BaseImpl.DashboardData)
            });
            serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.Win.DashboardsWindowsFormsModule());
            serverApplication.Modules.Add(new DevExpress.ExpressApp.FileAttachments.Win.FileAttachmentsWindowsFormsModule());
            serverApplication.Modules.Add(new DevExpress.ExpressApp.Notifications.NotificationsModule());
            serverApplication.Modules.Add(new DevExpress.ExpressApp.Notifications.Win.NotificationsWindowsFormsModule());
            serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.ReportsModuleV2()
            {
                ReportDataType = typeof(DevExpress.Persistent.BaseImpl.ReportDataV2)
            });
            serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.Win.ReportsWindowsFormsModuleV2());
            serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.ValidationModule());
            serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Win.ValidationWindowsFormsModule());
            serverApplication.Modules.Add(new DevExpress.ExpressApp.ViewVariantsModule.ViewVariantsModule());
            serverApplication.Modules.EndInit();

            serverApplication.DatabaseVersionMismatch         += new EventHandler <DatabaseVersionMismatchEventArgs>(serverApplication_DatabaseVersionMismatch);
            serverApplication.CreateCustomObjectSpaceProvider += (s, e) =>
            {
                e.ObjectSpaceProviders.Add(new XPObjectSpaceProvider(e.ConnectionString, e.Connection));
                e.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(serverApplication.TypesInfo, null));
            };
            serverApplication.ConnectionString = connectionString;

            //System.Console.WriteLine("Setup...");
            serverApplication.Setup();
            //System.Console.WriteLine("CheckCompatibility...");
            serverApplication.CheckCompatibility();
            serverApplication.Dispose();

            //System.Console.WriteLine("Starting server...");
            Func <IDataServerSecurity> dataServerSecurityProvider = () =>
            {
                SecurityStrategyComplex security = new SecurityStrategyComplex(typeof(PermissionPolicyUser), typeof(PermissionPolicyRole), new AuthenticationStandard());
                security.SupportNavigationPermissionsForTypes = false;
                return(security);
            };

            //+++++ configból a connection stringet: net.tcp://127.0.0.1:1451/DataServer
            xafServiceHost = new WcfXafServiceHost(connectionString, dataServerSecurityProvider);
            xafServiceHost.AddServiceEndpoint(typeof(IWcfXafDataServer), WcfDataServerHelper.CreateNetTcpBinding(), "net.tcp://127.0.0.1:1451/DataServer");
            xafServiceHost.Open();
            System.Console.WriteLine("XAF service inited.");

            //test
            ConnectionHelper.Connect(DevExpress.Xpo.DB.AutoCreateOption.DatabaseAndSchema, true);
            System.Console.WriteLine("ConnectionHelper connected.");
        }
Example #12
0
        static void Main(string[] args)
        {
            try {
                string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

                ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition();

                SecurityAdapterHelper.Enable();
                ServerApplication serverApplication = new ServerApplication();
                serverApplication.ApplicationName        = "P3TEK";
                serverApplication.CheckCompatibilityType = CheckCompatibilityType.DatabaseSchema;
#if DEBUG
                if (System.Diagnostics.Debugger.IsAttached && serverApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema)
                {
                    serverApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
                }
#endif

                serverApplication.Modules.BeginInit();
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Security.SecurityModule());
                serverApplication.Modules.Add(new P3TEK.Module.P3TEKModule());
                serverApplication.Modules.Add(new P3TEK.Module.Win.P3TEKWindowsFormsModule());
                serverApplication.Modules.Add(new P3TEK.Module.Web.P3TEKAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.AuditTrail.AuditTrailModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Objects.BusinessClassLibraryCustomizationModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.ChartModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.Win.ChartWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.Web.ChartAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.CloneObject.CloneObjectModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ConditionalAppearance.ConditionalAppearanceModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.DashboardsModule()
                {
                    DashboardDataType = typeof(DevExpress.Persistent.BaseImpl.DashboardData)
                });
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.Win.DashboardsWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.Web.DashboardsAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.FileAttachments.Win.FileAttachmentsWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.FileAttachments.Web.FileAttachmentsAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.HtmlPropertyEditor.Win.HtmlPropertyEditorWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.HtmlPropertyEditor.Web.HtmlPropertyEditorAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Kpi.KpiModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.PivotChartModuleBase());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.Win.PivotChartWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.Web.PivotChartAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.PivotGridModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.Win.PivotGridWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.Web.PivotGridAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.ReportsModuleV2()
                {
                    ReportDataType = typeof(DevExpress.Persistent.BaseImpl.ReportDataV2)
                });
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.Win.ReportsWindowsFormsModuleV2());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.Web.ReportsAspNetModuleV2());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.TreeListEditorsModuleBase());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.Win.TreeListEditorsWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.Web.TreeListEditorsAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.ValidationModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Win.ValidationWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Web.ValidationAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ViewVariantsModule.ViewVariantsModule());
                serverApplication.Modules.EndInit();

                serverApplication.DatabaseVersionMismatch         += new EventHandler <DatabaseVersionMismatchEventArgs>(serverApplication_DatabaseVersionMismatch);
                serverApplication.CreateCustomObjectSpaceProvider += (s, e) => {
                    e.ObjectSpaceProviders.Add(new XPObjectSpaceProvider(e.ConnectionString, e.Connection));
                    e.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(serverApplication.TypesInfo, null));
                };

                serverApplication.ConnectionString = connectionString;

                Console.WriteLine("Setup...");
                serverApplication.Setup();
                Console.WriteLine("CheckCompatibility...");
                serverApplication.CheckCompatibility();
                serverApplication.Dispose();

                Console.WriteLine("Starting server...");
                Func <IDataServerSecurity> dataServerSecurityProvider = () =>
                {
                    SecurityStrategyComplex security = new SecurityStrategyComplex(typeof(PermissionPolicyUser), typeof(PermissionPolicyRole), new AuthenticationStandard());
                    security.SupportNavigationPermissionsForTypes = false;
                    return(security);
                };

                WcfXafServiceHost serviceHost = new WcfXafServiceHost(connectionString, dataServerSecurityProvider);
                serviceHost.AddServiceEndpoint(typeof(IWcfXafDataServer), WcfDataServerHelper.CreateNetTcpBinding(), "net.tcp://127.0.0.1:1451/DataServer");
                serviceHost.Open();
                Console.WriteLine("Server is started. Press Enter to stop.");
                Console.ReadLine();
                Console.WriteLine("Stopping...");
                serviceHost.Close();
                Console.WriteLine("Server is stopped.");
            }
            catch (Exception e) {
                Console.WriteLine("Exception occurs: " + e.Message);
                Console.WriteLine("Press Enter to close.");
                Console.ReadLine();
            }
        }
Example #13
0
        static void Main(string[] args)
        {
            try {
                string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

                ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition();

                ServerApplication serverApplication = new ServerApplication();
                serverApplication.ApplicationName        = "HRM";
                serverApplication.CheckCompatibilityType = CheckCompatibilityType.DatabaseSchema;
#if DEBUG
                if (System.Diagnostics.Debugger.IsAttached && serverApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema)
                {
                    serverApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
                }
#endif

                serverApplication.Modules.BeginInit();
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Security.SecurityModule());
                serverApplication.Modules.Add(new HRM.Module.HRMModule());
                serverApplication.Modules.Add(new HRM.Module.Win.HRMWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.ValidationModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Win.ValidationWindowsFormsModule());
                serverApplication.Modules.EndInit();

                serverApplication.DatabaseVersionMismatch         += new EventHandler <DatabaseVersionMismatchEventArgs>(serverApplication_DatabaseVersionMismatch);
                serverApplication.CreateCustomObjectSpaceProvider += (s, e) => {
                    e.ObjectSpaceProviders.Add(new XPObjectSpaceProvider(e.ConnectionString, e.Connection));
                    e.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(serverApplication.TypesInfo, null));
                };

                serverApplication.ConnectionString = connectionString;

                Console.WriteLine("Setup...");
                serverApplication.Setup();
                Console.WriteLine("CheckCompatibility...");
                serverApplication.CheckCompatibility();
                serverApplication.Dispose();

                Console.WriteLine("Starting server...");
                Func <IDataServerSecurity> dataServerSecurityProvider = () =>
                {
                    SecurityStrategyComplex security = new SecurityStrategyComplex(typeof(PermissionPolicyUser), typeof(PermissionPolicyRole), new AuthenticationStandard());
                    security.SupportNavigationPermissionsForTypes = false;
                    security.RegisterXPOAdapterProviders();
                    return(security);
                };

                WcfXafServiceHost serviceHost = new WcfXafServiceHost(connectionString, dataServerSecurityProvider);
                serviceHost.AddServiceEndpoint(typeof(IWcfXafDataServer), WcfDataServerHelper.CreateNetTcpBinding(), "net.tcp://127.0.0.1:61784/DataServer");
                serviceHost.Open();
                Console.WriteLine("Server is started. Press Enter to stop.");
                Console.ReadLine();
                Console.WriteLine("Stopping...");
                serviceHost.Close();
                Console.WriteLine("Server is stopped.");
            }
            catch (Exception e) {
                Console.WriteLine("Exception occurs: " + e.Message);
                Console.WriteLine("Press Enter to close.");
                Console.ReadLine();
            }
        }
Example #14
0
        static void Main(string[] args)
        {
            WcfDataServerHelper.AddKnownType(typeof(ExportPermissionRequest));
            try
            {
                string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

                ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition();

                SecurityAdapterHelper.Enable();
                ServerApplication serverApplication = new ServerApplication();
                serverApplication.ApplicationName        = "InsureCore";
                serverApplication.CheckCompatibilityType = CheckCompatibilityType.DatabaseSchema;
#if DEBUG
                if (System.Diagnostics.Debugger.IsAttached && serverApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema)
                {
                    serverApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
                }
#endif

                serverApplication.Modules.BeginInit();
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Security.SecurityModule());
                serverApplication.Modules.Add(new InsureCore.Module.InsureCoreModule());
                serverApplication.Modules.Add(new InsureCore.Module.Win.InsureCoreWindowsFormsModule());
                serverApplication.Modules.Add(new InsureCore.Module.Web.InsureCoreAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.AuditTrail.AuditTrailModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Objects.BusinessClassLibraryCustomizationModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.ChartModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.Win.ChartWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.Web.ChartAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.CloneObject.CloneObjectModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ConditionalAppearance.ConditionalAppearanceModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.DashboardsModule()
                {
                    DashboardDataType = typeof(DevExpress.Persistent.BaseImpl.DashboardData)
                });
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.Win.DashboardsWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.Web.DashboardsAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.FileAttachments.Win.FileAttachmentsWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.FileAttachments.Web.FileAttachmentsAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.HtmlPropertyEditor.Win.HtmlPropertyEditorWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.HtmlPropertyEditor.Web.HtmlPropertyEditorAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Kpi.KpiModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Maps.Web.MapsAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Notifications.NotificationsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Notifications.Win.NotificationsWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Notifications.Web.NotificationsAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.PivotChartModuleBase());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.Win.PivotChartWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.Web.PivotChartAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.PivotGridModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.Win.PivotGridWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.Web.PivotGridAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.ReportsModuleV2()
                {
                    ReportDataType = typeof(DevExpress.Persistent.BaseImpl.ReportDataV2)
                });
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.Win.ReportsWindowsFormsModuleV2());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.Web.ReportsAspNetModuleV2());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Scheduler.SchedulerModuleBase());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Scheduler.Win.SchedulerWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Scheduler.Web.SchedulerAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ScriptRecorder.ScriptRecorderModuleBase());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ScriptRecorder.Win.ScriptRecorderWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ScriptRecorder.Web.ScriptRecorderAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.StateMachine.StateMachineModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.TreeListEditorsModuleBase());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.Win.TreeListEditorsWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.Web.TreeListEditorsAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.ValidationModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Win.ValidationWindowsFormsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Web.ValidationAspNetModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.ViewVariantsModule.ViewVariantsModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Workflow.WorkflowModule());
                serverApplication.Modules.Add(new DevExpress.ExpressApp.Workflow.Win.WorkflowWindowsFormsModule());
                serverApplication.Modules.EndInit();

                serverApplication.DatabaseVersionMismatch         += new EventHandler <DatabaseVersionMismatchEventArgs>(serverApplication_DatabaseVersionMismatch);
                serverApplication.CreateCustomObjectSpaceProvider += new EventHandler <CreateCustomObjectSpaceProviderEventArgs>(serverApplication_CreateCustomObjectSpaceProvider);

                serverApplication.ConnectionString = connectionString;

                Console.WriteLine("Setup...");
                serverApplication.Setup();
                Console.WriteLine("CheckCompatibility...");
                serverApplication.CheckCompatibility();
                serverApplication.Dispose();

                Console.WriteLine("Starting server...");
                Func <IDataServerSecurity> dataServerSecurityProvider = () =>
                {
                    SecurityStrategyComplex security = new SecurityStrategyComplex(typeof(User), typeof(Role), new AuthenticationStandard());
                    security.SupportNavigationPermissionsForTypes = false;
                    security.CustomizeRequestProcessors          += delegate(object sender, CustomizeRequestProcessorsEventArgs e)
                    {
                        List <IOperationPermission> result = new List <IOperationPermission>();
                        if (security != null)
                        {
                            User user = security.User as User;
                            if (user != null)
                            {
                                foreach (Role role in user.Roles)
                                {
                                    if (role.CanExport)
                                    {
                                        result.Add(new ExportPermission());
                                    }
                                }
                            }
                        }
                        IPermissionDictionary permissionDictionary = new PermissionDictionary((IEnumerable <IOperationPermission>)result);
                        e.Processors.Add(typeof(ExportPermissionRequest), new ExportPermissionRequestProcessor(permissionDictionary));
                    };
                    return(security);
                };

                WcfXafServiceHost serviceHost = new WcfXafServiceHost(connectionString, dataServerSecurityProvider);
                serviceHost.AddServiceEndpoint(typeof(IWcfXafDataServer), WcfDataServerHelper.CreateNetTcpBinding(), "net.tcp://127.0.0.1:1451/DataServer");
                serviceHost.Open();
                Console.WriteLine("Server is started. Press Enter to stop.");
                Console.ReadLine();
                Console.WriteLine("Stopping...");
                serviceHost.Close();
                Console.WriteLine("Server is stopped.");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception occurs: " + e.Message);
                Console.WriteLine("Press Enter to close.");
                Console.ReadLine();
            }
        }