public EmployeeDataAccessLayer(ISuplexDal suplexDal)
        {
            //init Suplex DAL instance
            _suplexDal = suplexDal;

            //create some Employees
            _employees = new List <Employee>
            {
                { new Employee(1)
                  {
                      Name = "Irma Tahnee"
                  } },
                { new Employee(2)
                  {
                      Name = "Cat Maxwell"
                  } },
                { new Employee(3)
                  {
                      Name = "Krystelle Padma"
                  } },
                { new Employee(4)
                  {
                      Name = "Louis Zola"
                  } },
                { new Employee(5)
                  {
                      Name = "Esmaralda Grahame"
                  } }
            };
        }
        public void InitWebApiConnection(string baseUrl, string messageFormatType = "application/json")
        {
            _dal                = new SuplexSecurityHttpApiClient(baseUrl, messageFormatType, configureAwaitContinueOnCapturedContext: false);
            ConnectionPath      = baseUrl;
            IsServiceConnection = true;

            RefreshStore();
        }
        public void RehostDalToFileSystemDal()
        {
            List <GroupMembershipItem> gm = new List <GroupMembershipItem>(_dal.GetGroupMembership());;

            _dal = new FileSystemDal();
            AsFileSystemDal.Store = Store;
            AsFileSystemDal.Store.GroupMembership = gm;
            IsServiceConnection = false;
            ConnectionPath      = null;
        }
        public void InitFileSystemDal(string filePath, bool autoSave)
        {
            _dal = new FileSystemDal();
            if (!string.IsNullOrWhiteSpace(filePath))
            {
                AsFileSystemDal.Configure(new FileSystemDalConfig {
                    FilePath = filePath, AutomaticallyPersistChanges = autoSave
                });
            }
            ConnectionPath      = filePath;
            IsServiceConnection = false;

            RefreshStore();
        }
Exemplo n.º 5
0
        public SuplexController()
        {
            string configFileName = "Suplex.Security.WebApi.config.yaml";

            object config = Synapse.Services.ExtensibilityUtility.GetExecuteControllerInstance(null, null, null)?.GetCustomAssemblyConfig("Suplex.Security.WebApi");

            if (config != null)
            {
                SuplexDalConfig suplexDalConfig = SuplexDalConfig.FromObject(config);
                _dal = suplexDalConfig.GetDalInstance();
            }
            else if (File.Exists(configFileName))
            {
                string          configYaml      = File.ReadAllText(configFileName);
                SuplexDalConfig suplexDalConfig = SuplexDalConfig.FromYaml(configYaml);
                _dal = suplexDalConfig.GetDalInstance();
            }
        }
Exemplo n.º 6
0
    public void Initialize()
    {
        switch (Type)
        {
        case SuplexDalConnectionType.File:
        {
            _dal = FileSystemDal.LoadFromYamlFile(Path);
            PathLastWriteTime = File.GetLastWriteTimeUtc(Path);
            break;
        }

        case SuplexDalConnectionType.RestApi:
        {
            _dal = new SuplexSecurityHttpApiClient(Path);
            break;
        }
        }
    }