Skip to content

Commit 1c0c4ae

Browse files
committed
- cleaned up code
1 parent b5df63c commit 1c0c4ae

File tree

66 files changed

+162
-207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+162
-207
lines changed

src/SourceFlow.Net.EntityFramework/CommandDbContext.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#nullable enable
22

3-
using System;
43
using Microsoft.EntityFrameworkCore;
54
using SourceFlow.Stores.EntityFramework.Models;
65
using SourceFlow.Stores.EntityFramework.Options;
@@ -51,4 +50,4 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
5150
}
5251
}
5352
}
54-
}
53+
}

src/SourceFlow.Net.EntityFramework/Examples/DatabaseProviderExamples.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636

3737
// // Command store using SQLite
3838
// var commandConnectionString = "DataSource=:memory:command.db";
39-
39+
4040
// // Entity store using a different SQLite database
4141
// var entityConnectionString = "DataSource=:memory:entity.db";
42-
42+
4343
// // View model store using another SQLite database
4444
// var viewModelConnectionString = "DataSource=:memory:viewmodel.db";
4545

@@ -94,7 +94,7 @@
9494
// // This is the original method that uses SQL Server
9595
// services.AddSourceFlowEfStores(connectionString);
9696
// }
97-
97+
9898
// /// <summary>
9999
// /// Example: Using SQL Server with different connection strings per store
100100
// /// </summary>
@@ -115,4 +115,4 @@
115115
// );
116116
// }
117117
// }
118-
//}
118+
//}

src/SourceFlow.Net.EntityFramework/Examples/UsageExamples.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
// // Reads connection strings from configuration:
4848
// // ConnectionStrings:SourceFlow.Command
49-
// // ConnectionStrings:SourceFlow.Entity
49+
// // ConnectionStrings:SourceFlow.Entity
5050
// // ConnectionStrings:SourceFlow.ViewModel
5151
// services.AddSourceFlowEfStores(configuration);
5252
// }
@@ -73,4 +73,4 @@
7373
// private static string GetEntityConnectionString() => "Server=localhost;Database=SourceFlow.Entities;Trusted_Connection=true;";
7474
// private static string GetViewModelConnectionString() => "Server=localhost;Database=SourceFlow.ViewModels;Trusted_Connection=true;";
7575
// }
76-
//}
76+
//}

src/SourceFlow.Net.EntityFramework/Extensions/ServiceCollectionExtensions.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
using System;
2+
using Microsoft.EntityFrameworkCore;
23
using Microsoft.Extensions.Configuration;
34
using Microsoft.Extensions.DependencyInjection;
45
using Microsoft.Extensions.DependencyInjection.Extensions;
5-
using Microsoft.EntityFrameworkCore;
6-
using Microsoft.Extensions.Options;
7-
using Microsoft.Extensions.Primitives;
86
using SourceFlow.Stores.EntityFramework.Options;
97
using SourceFlow.Stores.EntityFramework.Services;
108
using SourceFlow.Stores.EntityFramework.Stores;
@@ -362,4 +360,4 @@ private static void ConfigureNamingConventions(SourceFlowEfOptions options)
362360
ViewModelDbContext.ConfigureNamingConvention(options.ViewModelTableNaming);
363361
}
364362
}
365-
}
363+
}

src/SourceFlow.Net.EntityFramework/Models/CommandRecord.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using Microsoft.EntityFrameworkCore;
33
using Microsoft.EntityFrameworkCore.Metadata.Builders;
4-
using SourceFlow.Messaging.Commands;
54

65
namespace SourceFlow.Stores.EntityFramework.Models
76
{
@@ -12,16 +11,18 @@ public class CommandRecord
1211
public int SequenceNo { get; set; }
1312
public string CommandName { get; set; } = string.Empty;
1413
public string CommandType { get; set; } = string.Empty;
15-
14+
1615
// Store command data in relational fields instead of serialization
1716
public string PayloadType { get; set; } = string.Empty;
17+
1818
public string PayloadData { get; set; } = string.Empty; // This can be JSON but for the payload itself
19-
19+
2020
public string Metadata { get; set; } = string.Empty; // Store metadata as JSON
2121
public DateTime Timestamp { get; set; }
22-
22+
2323
// Relational fields that can be indexed and queried
2424
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
25+
2526
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
2627
}
2728

@@ -35,4 +36,4 @@ public void Configure(EntityTypeBuilder<CommandRecord> builder)
3536
builder.HasIndex(c => c.Timestamp);
3637
}
3738
}
38-
}
39+
}

src/SourceFlow.Net.EntityFramework/Options/ObservabilityOptions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
31
namespace SourceFlow.Stores.EntityFramework.Options
42
{
53
/// <summary>

src/SourceFlow.Net.EntityFramework/Options/ResilienceOptions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
31
namespace SourceFlow.Stores.EntityFramework.Options
42
{
53
/// <summary>

src/SourceFlow.Net.EntityFramework/Options/SourceFlowEfOptions.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#nullable enable
22

33
using System;
4-
using System.ComponentModel.DataAnnotations;
54

65
namespace SourceFlow.Stores.EntityFramework.Options
76
{
@@ -14,17 +13,17 @@ public class SourceFlowEfOptions
1413
/// Connection string for command store
1514
/// </summary>
1615
public string? CommandConnectionString { get; set; }
17-
16+
1817
/// <summary>
1918
/// Connection string for entity store
2019
/// </summary>
2120
public string? EntityConnectionString { get; set; }
22-
21+
2322
/// <summary>
2423
/// Connection string for view model store
2524
/// </summary>
2625
public string? ViewModelConnectionString { get; set; }
27-
26+
2827
/// <summary>
2928
/// If true, a single connection string will be used for all stores
3029
/// </summary>
@@ -64,17 +63,17 @@ public string GetConnectionString(StoreType storeType)
6463
{
6564
return storeType switch
6665
{
67-
StoreType.Command => CommandConnectionString ?? DefaultConnectionString
66+
StoreType.Command => CommandConnectionString ?? DefaultConnectionString
6867
?? throw new InvalidOperationException("Command connection string not configured"),
69-
StoreType.Entity => EntityConnectionString ?? DefaultConnectionString
68+
StoreType.Entity => EntityConnectionString ?? DefaultConnectionString
7069
?? throw new InvalidOperationException("Entity connection string not configured"),
71-
StoreType.ViewModel => ViewModelConnectionString ?? DefaultConnectionString
70+
StoreType.ViewModel => ViewModelConnectionString ?? DefaultConnectionString
7271
?? throw new InvalidOperationException("ViewModel connection string not configured"),
7372
_ => throw new ArgumentException($"Unknown store type: {storeType}", nameof(storeType))
7473
};
7574
}
7675
}
77-
76+
7877
/// <summary>
7978
/// Enum representing different store types
8079
/// </summary>
@@ -84,4 +83,4 @@ public enum StoreType
8483
Entity,
8584
ViewModel
8685
}
87-
}
86+
}

src/SourceFlow.Net.EntityFramework/Services/DatabaseTelemetryService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class DatabaseTelemetryService : IDatabaseTelemetryService
2020

2121
// Counters
2222
private readonly Counter<long>? _commandsAppended;
23+
2324
private readonly Counter<long>? _commandsLoaded;
2425
private readonly Counter<long>? _entitiesPersisted;
2526
private readonly Counter<long>? _viewModelsPersisted;

src/SourceFlow.Net.EntityFramework/Stores/EfCommandStore.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using SourceFlow.Stores.EntityFramework.Models;
88
using SourceFlow.Stores.EntityFramework.Services;
99

10-
1110
namespace SourceFlow.Stores.EntityFramework.Stores
1211
{
1312
public class EfCommandStore : ICommandStore
@@ -105,4 +104,4 @@ public async Task<IEnumerable<CommandData>> Load(int entityId)
105104
});
106105
}
107106
}
108-
}
107+
}

0 commit comments

Comments
 (0)