Skip to content

Commit

Permalink
chore: make samples identical w/ their copies in samples repo
Browse files Browse the repository at this point in the history
  • Loading branch information
alexyakunin committed Sep 18, 2021
1 parent e03835b commit ac9fc3f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions samples/HelloCart/v2/AppV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public AppV2()
// Add AppDbContext & related services
var appTempDir = PathExt.GetApplicationTempDirectory("", true);
var dbPath = appTempDir & "HelloCart_v01.db";
services.AddDbContextFactory<AppDbContext>(b => {
b.UseSqlite($"Data Source={dbPath}");
b.EnableSensitiveDataLogging();
services.AddDbContextFactory<AppDbContext>(dbContext => {
dbContext.UseSqlite($"Data Source={dbPath}");
dbContext.EnableSensitiveDataLogging();
});
services.AddDbContextServices<AppDbContext>(b => {
b.AddOperations((_, o) => {
services.AddDbContextServices<AppDbContext>(dbContext => {
dbContext.AddOperations((_, o) => {
o.UnconditionalWakeUpPeriod = TimeSpan.FromSeconds(5);
});
b.AddFileBasedOperationLogChangeTracking(dbPath + "_changed");
dbContext.AddFileBasedOperationLogChangeTracking(dbPath + "_changed");
});
ClientServices = HostServices = services.BuildServiceProvider();
}
Expand Down
16 changes: 8 additions & 8 deletions samples/HelloCart/v3/AppV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ public AppV3()
// Add AppDbContext & related services
var appTempDir = PathExt.GetApplicationTempDirectory("", true);
var dbPath = appTempDir & "HelloCart_v01.db";
services.AddDbContextFactory<AppDbContext>(b => {
b.UseSqlite($"Data Source={dbPath}");
b.EnableSensitiveDataLogging();
services.AddDbContextFactory<AppDbContext>(dbContext => {
dbContext.UseSqlite($"Data Source={dbPath}");
dbContext.EnableSensitiveDataLogging();
});
services.AddDbContextServices<AppDbContext>(b => {
b.AddOperations((_, o) => {
services.AddDbContextServices<AppDbContext>(dbContext => {
dbContext.AddOperations((_, o) => {
o.UnconditionalWakeUpPeriod = TimeSpan.FromSeconds(5);
});
b.AddFileBasedOperationLogChangeTracking(dbPath + "_changed");
b.AddEntityResolver<string, DbProduct>();
b.AddEntityResolver<string, DbCart>((_, options) => {
dbContext.AddFileBasedOperationLogChangeTracking(dbPath + "_changed");
dbContext.AddEntityResolver<string, DbProduct>();
dbContext.AddEntityResolver<string, DbCart>((_, options) => {
// Cart is always loaded together with items
options.QueryTransformer = carts => carts.Include(c => c.Items);
});
Expand Down
20 changes: 10 additions & 10 deletions samples/HelloCart/v4/AppV4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ protected IHost BuildHost(Uri baseUri)
// Add AppDbContext & related services
var appTempDir = PathExt.GetApplicationTempDirectory("", true);
var dbPath = appTempDir & "HelloCart_v01.db";
services.AddDbContextFactory<AppDbContext>(b => {
b.UseSqlite($"Data Source={dbPath}");
b.EnableSensitiveDataLogging();
services.AddDbContextFactory<AppDbContext>(dbContext => {
dbContext.UseSqlite($"Data Source={dbPath}");
dbContext.EnableSensitiveDataLogging();
});
services.AddDbContextServices<AppDbContext>(b => {
b.AddOperations((_, o) => { o.UnconditionalWakeUpPeriod = TimeSpan.FromSeconds(5); });
b.AddFileBasedOperationLogChangeTracking(dbPath + "_changed");
b.AddEntityResolver<string, DbProduct>();
b.AddEntityResolver<string, DbCart>((_, options) => {
services.AddDbContextServices<AppDbContext>(dbContext => {
dbContext.AddOperations((_, o) => { o.UnconditionalWakeUpPeriod = TimeSpan.FromSeconds(5); });
dbContext.AddFileBasedOperationLogChangeTracking(dbPath + "_changed");
dbContext.AddEntityResolver<string, DbProduct>();
dbContext.AddEntityResolver<string, DbCart>((_, options) => {
// Cart is always loaded together with items
options.QueryTransformer = carts => carts.Include(c => c.Items);
});
Expand Down Expand Up @@ -89,8 +89,8 @@ protected IServiceProvider BuildClientServices(Uri baseUri)
options.HttpClientActions.Add(httpClient => httpClient.BaseAddress = apiBaseUri);
});
client.ConfigureWebSocketChannel((c, options) => { options.BaseUri = baseUri; });
client.AddReplicaService<IProductService, IProductClient>();
client.AddReplicaService<ICartService, ICartClient>();
client.AddReplicaService<IProductService, IProductClientDef>();
client.AddReplicaService<ICartService, ICartClientDef>();
});
});
return services.BuildServiceProvider();
Expand Down
4 changes: 2 additions & 2 deletions samples/HelloCart/v4/Clients.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Samples.HelloCart.V4
{
[BasePath("product")]
public interface IProductClient
public interface IProductClientDef
{
[Post("edit")]
Task Edit([Body] EditCommand<Product> command, CancellationToken cancellationToken);
Expand All @@ -14,7 +14,7 @@ public interface IProductClient
}

[BasePath("cart")]
public interface ICartClient
public interface ICartClientDef
{
[Post("edit")]
Task Edit([Body] EditCommand<Cart> command, CancellationToken cancellationToken);
Expand Down

0 comments on commit ac9fc3f

Please sign in to comment.