State

Define data persistence model settings in the State adapter such as MongoDB, Redis, SQLServer, Elastic, and others. DevPrime supports more than one State model.

Setting up State with MongoDB`

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
    "DevPrime_State": [

        {
          "alias": "State1",
          "dbtype": "mongodb",
          "connection": "mongodb://mongoadmin:LltF8Nx*yo@localhost:27017",
          "timeout": "5",
          "retry": "2",
          "dbname": "order",
          "isssl": "true",
          "numberofattempts": "4",
          "durationofbreak": "45"
        }
      ]

Setting state with SQLServer

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
    "DevPrime_State": [

        {
          "alias": "State1",
          "dbtype": "sqlserver",
          "dbprovider": "ef",
          "connection": "Data Source=localhost;Initial Catalog=model;User ID=sa;Password=LltF8Nx*yo;Min Pool Size=10;Max Pool Size=100;",
          "timeout": "5",
          "retry": "2",
          "durationofbreak": "45"
        }
      ]

Setting up State with Redis

1
2
3
4
5
6
7
8
9
     {
          "enable": "true",
          "alias": "State1",
          "dbtype": "redis",
          "connection": "127.0.0.x:6379",
          "timeout": "5",
          "retry": "2",
          "durationofbreak": "45"
        }

DevPrime supports the use of more than one State in microservices as per example using MongoDB in State1 and Redis in State2.

1
2
3
4
5
6
7
8
9
        {
          "enable": "true",
          "alias": "State2",
          "dbtype": "redis",
          "connection": "127.0.0.x:6379",
          "timeout": "5",
          "retry": "2",
          "durationofbreak": "45"
        }
Last modified March 10, 2022 (615ec2b)