Пример #1
0
        public static void RegisterInterfaces()
        {
#if TUTORIAL_CUSTOM_DATABASE
            // The 'RegisterInterfaces' method is implemented as part of the "Changing the LEAD HTML5 Medical Viewer to use a different database schema" tutorial.
            // For the tutorial, 'RegisterInterfaces' is used to register custom classes that you define to interact with a custom database.
            // For the shipping version, the 'RegisterInterfaces' does nothing
            //
            // Since the WCF services are stateless (below), this method is called before using any of the services.
            // The AddinsFactory class is used to generate the addins required by each of the services.
            // So the AddinsFactory constructor calls 'RegisterInterfaces' if it has not already been called.
            //
            // WCF Services:
            // * AuthenticationService
            // * ObjectRetrieveService
            // * PacsQueryService
            // * PACSRetrieveService
            // * StoreService
            //
            // The MyPatientInfo, MyStudyInfo, MySeriesInfo, and MyInstanceInfo classes are used for extracting DICOM data from a System.Data.DataRow.
            // The MyStorageSqlDbDataAccessAgent and MyStorageDataAccessConfigurationView classes are used for accessing your custom database
            // The MyPatient, MyStudy, MySeries, and MyInstance classes are used to generate the WHERE statement of the database query
            // For more details, see the "Changing the LEAD HTML5 Medical Viewer to use a different database schema" tutorial.

            if (!DataAccessServiceLocator.IsRegistered <IPatientInfo>())
            {
                DataAccessServiceLocator.Register <IPatientInfo>(new MyPatientInfo());
            }

            if (!DataAccessServiceLocator.IsRegistered <IStudyInfo>())
            {
                DataAccessServiceLocator.Register <IStudyInfo>(new MyStudyInfo());
            }

            if (!DataAccessServiceLocator.IsRegistered <ISeriesInfo>())
            {
                DataAccessServiceLocator.Register <ISeriesInfo>(new MySeriesInfo());
            }

            if (!DataAccessServiceLocator.IsRegistered <IInstanceInfo>())
            {
                DataAccessServiceLocator.Register <IInstanceInfo>(new MyInstanceInfo());
            }

            if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent3>())
            {
                System.Configuration.Configuration configuration     = ServiceUtils.GetGlobalPacsConfig();
                IStorageDataAccessAgent3           storageDataAccess = DataAccessFactory.GetInstance(new MyStorageDataAccessConfigurationView(configuration, ServiceUtils.ProductNameStorageServer, null)).CreateDataAccessAgent <IStorageDataAccessAgent3>();
                DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent3>(storageDataAccess);
            }

            RegisteredEntities.AddItem(RegisteredEntities.PatientEntityName, typeof(MyPatient));
            RegisteredEntities.AddItem(RegisteredEntities.StudyEntityName, typeof(MyStudy));
            RegisteredEntities.AddItem(RegisteredEntities.SeriesEntityName, typeof(MySeries));
            RegisteredEntities.AddItem(RegisteredEntities.InstanceEntityName, typeof(MyInstance));
#endif
        }