Skip to content

Samples

Tomas Fabian edited this page Apr 22, 2020 · 28 revisions

Installation instructions

Set (multiple) startup project(s):

  • WPF (NET Core 3.1 and NET Framework 4.72) with EntityChangesViewModel example (Joker.WPF.Sample.csproj). If the OData service is running, you can run multiple WPF instances and all will be refreshed via PubSub after Http POST, PATCH, PUT or DELETE. WPF repository.
  • OData server with SqlTableDependencyRedisProvider (SelfHostedODataService.csproj)
  • Console app with SqlTableDependencyProvider and SqlTableDependencyRedisProvider (SqlTableDependency.Extensions.Sample.csproj)

Git

git clone https://github.com/tomasfabian/SqlTableDependency.Extensions.git

CD SqlTableDependency.Extensions

Docker:

Install Docker:

https://www.docker.com/products/docker-desktop

Run MS SQL Server 2017 latest:

docker run --name sql -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=YourNewStrong@Passw0rd" -p 1401:1433 -d mcr.microsoft.com/mssql/server:2017-latest

Test SQL Server:

docker exec -it sql /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1,1433-U SA -P "YourNewStrong@Passw0rd" 1> SELECT GETDATE() 2> GO

Run Redis latest:

docker run --name redis-server -p 6379:6379 -d redis

Test redis:

docker run -it --name my-redis-cli --link redis-server:redis --rm redis redis-cli -h redis -p 6379

redis:6379> SET myKey Test

OK

redis:6379> GET myKey

"Test"

Examples Entity Framework migrations:

The Test database with Products table is created automatically at startup or you can create it manually:

Package Manager Console (Default project => Examples\Samples.Data):

Update-Database -ConnectionString "Server=127.0.0.1,1401;User Id = SA;Password=YourNewStrong@Passw0rd;Initial Catalog = Test;" -ConnectionProviderName "System.Data.SqlClient" -ProjectName Sample.Data -verbose

OData example with Docker:

docker network create sqlnetwork
docker network ls

docker run --name sqln --network sqlnetwork -v sqldata:/var/opt/mssql -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=YourNewStrong@Passw0rd" -p 1402:1433 -d mcr.microsoft.com/mssql/server:2017-latest

docker run --network sqlnetwork --name redis-server -p 6379:6379 -d redis

#dev

docker build -f Dockerfile.dev -t tomasfabian/jokerodatadev .

docker run -it --rm --network sqlnetwork -v ${pwd}:/app -p 3000:80 -e REDISHOST=redis-server -e DBHOST=sqln --name jokerodatadev tomasfabian/jokerodatadev

#release https://hub.docker.com/repository/docker/tomasfabian/jokerodata

#docker build -f Dockerfile -t tomasfabian/jokerodata

docker run -it --rm --network sqlnetwork -p 3000:80 -e REDISHOST=redis-server -e DBHOST=sqln --name jokerodata tomasfabian/jokerodata

Test OData endpoint: http://localhost:3000/Products