@atlashub/smartstack-mcp 1.2.3 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -88
- package/config/default-config.json +62 -62
- package/dist/index.js +2196 -119
- package/dist/index.js.map +1 -1
- package/package.json +65 -65
- package/templates/component.tsx.hbs +298 -298
- package/templates/controller.cs.hbs +166 -166
- package/templates/entity-extension.cs.hbs +231 -231
- package/templates/service-extension.cs.hbs +53 -53
|
@@ -1,231 +1,231 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using System.ComponentModel.DataAnnotations;
|
|
3
|
-
using SmartStack.Domain.Common;
|
|
4
|
-
using SmartStack.Domain.Common.Interfaces;
|
|
5
|
-
|
|
6
|
-
namespace {{namespace}};
|
|
7
|
-
|
|
8
|
-
/// <summary>
|
|
9
|
-
/// {{name}} entity{{#if baseEntity}} extending {{baseEntity}}{{/if}}
|
|
10
|
-
/// </summary>
|
|
11
|
-
{{#if isSystemEntity}}
|
|
12
|
-
public class {{name}} : SystemEntity
|
|
13
|
-
{{else}}
|
|
14
|
-
public class {{name}} : BaseEntity
|
|
15
|
-
{{/if}}
|
|
16
|
-
{
|
|
17
|
-
{{#if baseEntity}}
|
|
18
|
-
/// <summary>
|
|
19
|
-
/// Foreign key to {{baseEntity}}
|
|
20
|
-
/// </summary>
|
|
21
|
-
public Guid {{baseEntity}}Id { get; private set; }
|
|
22
|
-
|
|
23
|
-
/// <summary>
|
|
24
|
-
/// Navigation property to {{baseEntity}}
|
|
25
|
-
/// </summary>
|
|
26
|
-
public virtual {{baseEntity}}? {{baseEntity}} { get; private set; }
|
|
27
|
-
|
|
28
|
-
{{/if}}
|
|
29
|
-
// === BUSINESS PROPERTIES ===
|
|
30
|
-
// TODO: Add {{name}} specific properties here
|
|
31
|
-
|
|
32
|
-
/// <summary>
|
|
33
|
-
/// Private constructor for EF Core
|
|
34
|
-
/// </summary>
|
|
35
|
-
private {{name}}() { }
|
|
36
|
-
|
|
37
|
-
/// <summary>
|
|
38
|
-
/// Factory method to create a new {{name}}
|
|
39
|
-
/// </summary>
|
|
40
|
-
{{#if isSystemEntity}}
|
|
41
|
-
public static {{name}} Create(
|
|
42
|
-
string code,
|
|
43
|
-
string? createdBy = null)
|
|
44
|
-
{
|
|
45
|
-
return new {{name}}
|
|
46
|
-
{
|
|
47
|
-
Id = Guid.NewGuid(),
|
|
48
|
-
Code = code.ToLowerInvariant(),
|
|
49
|
-
CreatedAt = DateTime.UtcNow,
|
|
50
|
-
CreatedBy = createdBy
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
{{else}}
|
|
54
|
-
public static {{name}} Create(
|
|
55
|
-
Guid tenantId,
|
|
56
|
-
string code,
|
|
57
|
-
string? createdBy = null)
|
|
58
|
-
{
|
|
59
|
-
return new {{name}}
|
|
60
|
-
{
|
|
61
|
-
Id = Guid.NewGuid(),
|
|
62
|
-
TenantId = tenantId,
|
|
63
|
-
Code = code.ToLowerInvariant(),
|
|
64
|
-
CreatedAt = DateTime.UtcNow,
|
|
65
|
-
CreatedBy = createdBy
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
{{/if}}
|
|
69
|
-
|
|
70
|
-
/// <summary>
|
|
71
|
-
/// Update the entity
|
|
72
|
-
/// </summary>
|
|
73
|
-
public void Update(string? updatedBy = null)
|
|
74
|
-
{
|
|
75
|
-
UpdatedAt = DateTime.UtcNow;
|
|
76
|
-
UpdatedBy = updatedBy;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/// <summary>
|
|
80
|
-
/// Soft delete the entity
|
|
81
|
-
/// </summary>
|
|
82
|
-
public void SoftDelete(string? deletedBy = null)
|
|
83
|
-
{
|
|
84
|
-
IsDeleted = true;
|
|
85
|
-
DeletedAt = DateTime.UtcNow;
|
|
86
|
-
DeletedBy = deletedBy;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/// <summary>
|
|
90
|
-
/// Restore a soft-deleted entity
|
|
91
|
-
/// </summary>
|
|
92
|
-
public void Restore(string? restoredBy = null)
|
|
93
|
-
{
|
|
94
|
-
IsDeleted = false;
|
|
95
|
-
DeletedAt = null;
|
|
96
|
-
DeletedBy = null;
|
|
97
|
-
UpdatedAt = DateTime.UtcNow;
|
|
98
|
-
UpdatedBy = restoredBy;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// ============================================================================
|
|
103
|
-
// Base Entity Classes (SmartStack.Domain.Common)
|
|
104
|
-
// ============================================================================
|
|
105
|
-
/*
|
|
106
|
-
/// <summary>
|
|
107
|
-
/// Base entity for tenant-scoped entities (default)
|
|
108
|
-
/// </summary>
|
|
109
|
-
public abstract class BaseEntity : ITenantEntity, IHasCode, ISoftDeletable, IVersioned
|
|
110
|
-
{
|
|
111
|
-
public Guid Id { get; set; } = Guid.NewGuid();
|
|
112
|
-
public Guid TenantId { get; set; }
|
|
113
|
-
|
|
114
|
-
private string _code = string.Empty;
|
|
115
|
-
public string Code
|
|
116
|
-
{
|
|
117
|
-
get => _code;
|
|
118
|
-
set => _code = value?.ToLowerInvariant() ?? string.Empty;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
122
|
-
public DateTime? UpdatedAt { get; set; }
|
|
123
|
-
public string? CreatedBy { get; set; }
|
|
124
|
-
public string? UpdatedBy { get; set; }
|
|
125
|
-
|
|
126
|
-
public bool IsDeleted { get; set; }
|
|
127
|
-
public DateTime? DeletedAt { get; set; }
|
|
128
|
-
public string? DeletedBy { get; set; }
|
|
129
|
-
|
|
130
|
-
public byte[] RowVersion { get; set; } = Array.Empty<byte>();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/// <summary>
|
|
134
|
-
/// Base entity for system-wide entities (no tenant isolation)
|
|
135
|
-
/// </summary>
|
|
136
|
-
public abstract class SystemEntity : ISystemEntity, IHasCode, ISoftDeletable, IVersioned
|
|
137
|
-
{
|
|
138
|
-
public Guid Id { get; set; } = Guid.NewGuid();
|
|
139
|
-
|
|
140
|
-
private string _code = string.Empty;
|
|
141
|
-
public string Code
|
|
142
|
-
{
|
|
143
|
-
get => _code;
|
|
144
|
-
set => _code = value?.ToLowerInvariant() ?? string.Empty;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
148
|
-
public DateTime? UpdatedAt { get; set; }
|
|
149
|
-
public string? CreatedBy { get; set; }
|
|
150
|
-
public string? UpdatedBy { get; set; }
|
|
151
|
-
|
|
152
|
-
public bool IsDeleted { get; set; }
|
|
153
|
-
public DateTime? DeletedAt { get; set; }
|
|
154
|
-
public string? DeletedBy { get; set; }
|
|
155
|
-
|
|
156
|
-
public byte[] RowVersion { get; set; } = Array.Empty<byte>();
|
|
157
|
-
}
|
|
158
|
-
*/
|
|
159
|
-
|
|
160
|
-
// ============================================================================
|
|
161
|
-
// EF Core Configuration
|
|
162
|
-
// ============================================================================
|
|
163
|
-
namespace {{infrastructureNamespace}}.Persistence.Configurations;
|
|
164
|
-
|
|
165
|
-
using Microsoft.EntityFrameworkCore;
|
|
166
|
-
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
167
|
-
using {{domainNamespace}};
|
|
168
|
-
|
|
169
|
-
public class {{name}}Configuration : IEntityTypeConfiguration<{{name}}>
|
|
170
|
-
{
|
|
171
|
-
public void Configure(EntityTypeBuilder<{{name}}> builder)
|
|
172
|
-
{
|
|
173
|
-
// Table name with schema and domain prefix
|
|
174
|
-
builder.ToTable("{{tablePrefix}}{{name}}s", "{{schema}}");
|
|
175
|
-
|
|
176
|
-
// Primary key
|
|
177
|
-
builder.HasKey(e => e.Id);
|
|
178
|
-
|
|
179
|
-
{{#unless isSystemEntity}}
|
|
180
|
-
// Multi-tenant
|
|
181
|
-
builder.Property(e => e.TenantId).IsRequired();
|
|
182
|
-
builder.HasIndex(e => e.TenantId);
|
|
183
|
-
|
|
184
|
-
// Code: lowercase, unique per tenant (filtered for soft delete)
|
|
185
|
-
builder.Property(e => e.Code).HasMaxLength(100).IsRequired();
|
|
186
|
-
builder.HasIndex(e => new { e.TenantId, e.Code })
|
|
187
|
-
.IsUnique()
|
|
188
|
-
.HasFilter("[IsDeleted] = 0")
|
|
189
|
-
.HasDatabaseName("IX_{{tablePrefix}}{{name}}s_Tenant_Code_Unique");
|
|
190
|
-
{{else}}
|
|
191
|
-
// Code: lowercase, unique (filtered for soft delete)
|
|
192
|
-
builder.Property(e => e.Code).HasMaxLength(100).IsRequired();
|
|
193
|
-
builder.HasIndex(e => e.Code)
|
|
194
|
-
.IsUnique()
|
|
195
|
-
.HasFilter("[IsDeleted] = 0")
|
|
196
|
-
.HasDatabaseName("IX_{{tablePrefix}}{{name}}s_Code_Unique");
|
|
197
|
-
{{/unless}}
|
|
198
|
-
|
|
199
|
-
// Concurrency token
|
|
200
|
-
builder.Property(e => e.RowVersion).IsRowVersion();
|
|
201
|
-
|
|
202
|
-
// Audit fields
|
|
203
|
-
builder.Property(e => e.CreatedBy).HasMaxLength(256);
|
|
204
|
-
builder.Property(e => e.UpdatedBy).HasMaxLength(256);
|
|
205
|
-
builder.Property(e => e.DeletedBy).HasMaxLength(256);
|
|
206
|
-
|
|
207
|
-
{{#if baseEntity}}
|
|
208
|
-
// Relationship to {{baseEntity}} (1:1)
|
|
209
|
-
builder.HasOne(e => e.{{baseEntity}})
|
|
210
|
-
.WithOne()
|
|
211
|
-
.HasForeignKey<{{name}}>(e => e.{{baseEntity}}Id)
|
|
212
|
-
.OnDelete(DeleteBehavior.Cascade);
|
|
213
|
-
|
|
214
|
-
// Index on foreign key
|
|
215
|
-
builder.HasIndex(e => e.{{baseEntity}}Id)
|
|
216
|
-
.IsUnique();
|
|
217
|
-
{{/if}}
|
|
218
|
-
|
|
219
|
-
// TODO: Add additional configuration
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// ============================================================================
|
|
224
|
-
// DbContext Update (add to ApplicationDbContext.cs)
|
|
225
|
-
// ============================================================================
|
|
226
|
-
// public DbSet<{{name}}> {{name}}s => Set<{{name}}>();
|
|
227
|
-
|
|
228
|
-
// ============================================================================
|
|
229
|
-
// Migration Command
|
|
230
|
-
// ============================================================================
|
|
231
|
-
// dotnet ef migrations add core_vX.X.X_XXX_Add{{name}} --context ApplicationDbContext
|
|
1
|
+
using System;
|
|
2
|
+
using System.ComponentModel.DataAnnotations;
|
|
3
|
+
using SmartStack.Domain.Common;
|
|
4
|
+
using SmartStack.Domain.Common.Interfaces;
|
|
5
|
+
|
|
6
|
+
namespace {{namespace}};
|
|
7
|
+
|
|
8
|
+
/// <summary>
|
|
9
|
+
/// {{name}} entity{{#if baseEntity}} extending {{baseEntity}}{{/if}}
|
|
10
|
+
/// </summary>
|
|
11
|
+
{{#if isSystemEntity}}
|
|
12
|
+
public class {{name}} : SystemEntity
|
|
13
|
+
{{else}}
|
|
14
|
+
public class {{name}} : BaseEntity
|
|
15
|
+
{{/if}}
|
|
16
|
+
{
|
|
17
|
+
{{#if baseEntity}}
|
|
18
|
+
/// <summary>
|
|
19
|
+
/// Foreign key to {{baseEntity}}
|
|
20
|
+
/// </summary>
|
|
21
|
+
public Guid {{baseEntity}}Id { get; private set; }
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
/// Navigation property to {{baseEntity}}
|
|
25
|
+
/// </summary>
|
|
26
|
+
public virtual {{baseEntity}}? {{baseEntity}} { get; private set; }
|
|
27
|
+
|
|
28
|
+
{{/if}}
|
|
29
|
+
// === BUSINESS PROPERTIES ===
|
|
30
|
+
// TODO: Add {{name}} specific properties here
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// Private constructor for EF Core
|
|
34
|
+
/// </summary>
|
|
35
|
+
private {{name}}() { }
|
|
36
|
+
|
|
37
|
+
/// <summary>
|
|
38
|
+
/// Factory method to create a new {{name}}
|
|
39
|
+
/// </summary>
|
|
40
|
+
{{#if isSystemEntity}}
|
|
41
|
+
public static {{name}} Create(
|
|
42
|
+
string code,
|
|
43
|
+
string? createdBy = null)
|
|
44
|
+
{
|
|
45
|
+
return new {{name}}
|
|
46
|
+
{
|
|
47
|
+
Id = Guid.NewGuid(),
|
|
48
|
+
Code = code.ToLowerInvariant(),
|
|
49
|
+
CreatedAt = DateTime.UtcNow,
|
|
50
|
+
CreatedBy = createdBy
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
{{else}}
|
|
54
|
+
public static {{name}} Create(
|
|
55
|
+
Guid tenantId,
|
|
56
|
+
string code,
|
|
57
|
+
string? createdBy = null)
|
|
58
|
+
{
|
|
59
|
+
return new {{name}}
|
|
60
|
+
{
|
|
61
|
+
Id = Guid.NewGuid(),
|
|
62
|
+
TenantId = tenantId,
|
|
63
|
+
Code = code.ToLowerInvariant(),
|
|
64
|
+
CreatedAt = DateTime.UtcNow,
|
|
65
|
+
CreatedBy = createdBy
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
{{/if}}
|
|
69
|
+
|
|
70
|
+
/// <summary>
|
|
71
|
+
/// Update the entity
|
|
72
|
+
/// </summary>
|
|
73
|
+
public void Update(string? updatedBy = null)
|
|
74
|
+
{
|
|
75
|
+
UpdatedAt = DateTime.UtcNow;
|
|
76
|
+
UpdatedBy = updatedBy;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/// <summary>
|
|
80
|
+
/// Soft delete the entity
|
|
81
|
+
/// </summary>
|
|
82
|
+
public void SoftDelete(string? deletedBy = null)
|
|
83
|
+
{
|
|
84
|
+
IsDeleted = true;
|
|
85
|
+
DeletedAt = DateTime.UtcNow;
|
|
86
|
+
DeletedBy = deletedBy;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/// <summary>
|
|
90
|
+
/// Restore a soft-deleted entity
|
|
91
|
+
/// </summary>
|
|
92
|
+
public void Restore(string? restoredBy = null)
|
|
93
|
+
{
|
|
94
|
+
IsDeleted = false;
|
|
95
|
+
DeletedAt = null;
|
|
96
|
+
DeletedBy = null;
|
|
97
|
+
UpdatedAt = DateTime.UtcNow;
|
|
98
|
+
UpdatedBy = restoredBy;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// ============================================================================
|
|
103
|
+
// Base Entity Classes (SmartStack.Domain.Common)
|
|
104
|
+
// ============================================================================
|
|
105
|
+
/*
|
|
106
|
+
/// <summary>
|
|
107
|
+
/// Base entity for tenant-scoped entities (default)
|
|
108
|
+
/// </summary>
|
|
109
|
+
public abstract class BaseEntity : ITenantEntity, IHasCode, ISoftDeletable, IVersioned
|
|
110
|
+
{
|
|
111
|
+
public Guid Id { get; set; } = Guid.NewGuid();
|
|
112
|
+
public Guid TenantId { get; set; }
|
|
113
|
+
|
|
114
|
+
private string _code = string.Empty;
|
|
115
|
+
public string Code
|
|
116
|
+
{
|
|
117
|
+
get => _code;
|
|
118
|
+
set => _code = value?.ToLowerInvariant() ?? string.Empty;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
122
|
+
public DateTime? UpdatedAt { get; set; }
|
|
123
|
+
public string? CreatedBy { get; set; }
|
|
124
|
+
public string? UpdatedBy { get; set; }
|
|
125
|
+
|
|
126
|
+
public bool IsDeleted { get; set; }
|
|
127
|
+
public DateTime? DeletedAt { get; set; }
|
|
128
|
+
public string? DeletedBy { get; set; }
|
|
129
|
+
|
|
130
|
+
public byte[] RowVersion { get; set; } = Array.Empty<byte>();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/// <summary>
|
|
134
|
+
/// Base entity for system-wide entities (no tenant isolation)
|
|
135
|
+
/// </summary>
|
|
136
|
+
public abstract class SystemEntity : ISystemEntity, IHasCode, ISoftDeletable, IVersioned
|
|
137
|
+
{
|
|
138
|
+
public Guid Id { get; set; } = Guid.NewGuid();
|
|
139
|
+
|
|
140
|
+
private string _code = string.Empty;
|
|
141
|
+
public string Code
|
|
142
|
+
{
|
|
143
|
+
get => _code;
|
|
144
|
+
set => _code = value?.ToLowerInvariant() ?? string.Empty;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
148
|
+
public DateTime? UpdatedAt { get; set; }
|
|
149
|
+
public string? CreatedBy { get; set; }
|
|
150
|
+
public string? UpdatedBy { get; set; }
|
|
151
|
+
|
|
152
|
+
public bool IsDeleted { get; set; }
|
|
153
|
+
public DateTime? DeletedAt { get; set; }
|
|
154
|
+
public string? DeletedBy { get; set; }
|
|
155
|
+
|
|
156
|
+
public byte[] RowVersion { get; set; } = Array.Empty<byte>();
|
|
157
|
+
}
|
|
158
|
+
*/
|
|
159
|
+
|
|
160
|
+
// ============================================================================
|
|
161
|
+
// EF Core Configuration
|
|
162
|
+
// ============================================================================
|
|
163
|
+
namespace {{infrastructureNamespace}}.Persistence.Configurations;
|
|
164
|
+
|
|
165
|
+
using Microsoft.EntityFrameworkCore;
|
|
166
|
+
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
167
|
+
using {{domainNamespace}};
|
|
168
|
+
|
|
169
|
+
public class {{name}}Configuration : IEntityTypeConfiguration<{{name}}>
|
|
170
|
+
{
|
|
171
|
+
public void Configure(EntityTypeBuilder<{{name}}> builder)
|
|
172
|
+
{
|
|
173
|
+
// Table name with schema and domain prefix
|
|
174
|
+
builder.ToTable("{{tablePrefix}}{{name}}s", "{{schema}}");
|
|
175
|
+
|
|
176
|
+
// Primary key
|
|
177
|
+
builder.HasKey(e => e.Id);
|
|
178
|
+
|
|
179
|
+
{{#unless isSystemEntity}}
|
|
180
|
+
// Multi-tenant
|
|
181
|
+
builder.Property(e => e.TenantId).IsRequired();
|
|
182
|
+
builder.HasIndex(e => e.TenantId);
|
|
183
|
+
|
|
184
|
+
// Code: lowercase, unique per tenant (filtered for soft delete)
|
|
185
|
+
builder.Property(e => e.Code).HasMaxLength(100).IsRequired();
|
|
186
|
+
builder.HasIndex(e => new { e.TenantId, e.Code })
|
|
187
|
+
.IsUnique()
|
|
188
|
+
.HasFilter("[IsDeleted] = 0")
|
|
189
|
+
.HasDatabaseName("IX_{{tablePrefix}}{{name}}s_Tenant_Code_Unique");
|
|
190
|
+
{{else}}
|
|
191
|
+
// Code: lowercase, unique (filtered for soft delete)
|
|
192
|
+
builder.Property(e => e.Code).HasMaxLength(100).IsRequired();
|
|
193
|
+
builder.HasIndex(e => e.Code)
|
|
194
|
+
.IsUnique()
|
|
195
|
+
.HasFilter("[IsDeleted] = 0")
|
|
196
|
+
.HasDatabaseName("IX_{{tablePrefix}}{{name}}s_Code_Unique");
|
|
197
|
+
{{/unless}}
|
|
198
|
+
|
|
199
|
+
// Concurrency token
|
|
200
|
+
builder.Property(e => e.RowVersion).IsRowVersion();
|
|
201
|
+
|
|
202
|
+
// Audit fields
|
|
203
|
+
builder.Property(e => e.CreatedBy).HasMaxLength(256);
|
|
204
|
+
builder.Property(e => e.UpdatedBy).HasMaxLength(256);
|
|
205
|
+
builder.Property(e => e.DeletedBy).HasMaxLength(256);
|
|
206
|
+
|
|
207
|
+
{{#if baseEntity}}
|
|
208
|
+
// Relationship to {{baseEntity}} (1:1)
|
|
209
|
+
builder.HasOne(e => e.{{baseEntity}})
|
|
210
|
+
.WithOne()
|
|
211
|
+
.HasForeignKey<{{name}}>(e => e.{{baseEntity}}Id)
|
|
212
|
+
.OnDelete(DeleteBehavior.Cascade);
|
|
213
|
+
|
|
214
|
+
// Index on foreign key
|
|
215
|
+
builder.HasIndex(e => e.{{baseEntity}}Id)
|
|
216
|
+
.IsUnique();
|
|
217
|
+
{{/if}}
|
|
218
|
+
|
|
219
|
+
// TODO: Add additional configuration
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// ============================================================================
|
|
224
|
+
// DbContext Update (add to ApplicationDbContext.cs)
|
|
225
|
+
// ============================================================================
|
|
226
|
+
// public DbSet<{{name}}> {{name}}s => Set<{{name}}>();
|
|
227
|
+
|
|
228
|
+
// ============================================================================
|
|
229
|
+
// Migration Command
|
|
230
|
+
// ============================================================================
|
|
231
|
+
// dotnet ef migrations add core_vX.X.X_XXX_Add{{name}} --context ApplicationDbContext
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using System.Threading;
|
|
3
|
-
using System.Threading.Tasks;
|
|
4
|
-
using System.Collections.Generic;
|
|
5
|
-
using Microsoft.Extensions.Logging;
|
|
6
|
-
|
|
7
|
-
namespace {{namespace}};
|
|
8
|
-
|
|
9
|
-
/// <summary>
|
|
10
|
-
/// Interface for {{name}} service operations
|
|
11
|
-
/// </summary>
|
|
12
|
-
public interface I{{name}}Service
|
|
13
|
-
{
|
|
14
|
-
{{#each methods}}
|
|
15
|
-
/// <summary>
|
|
16
|
-
/// {{this}} operation
|
|
17
|
-
/// </summary>
|
|
18
|
-
Task<object> {{this}}(CancellationToken cancellationToken = default);
|
|
19
|
-
|
|
20
|
-
{{/each}}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/// <summary>
|
|
24
|
-
/// Implementation of {{name}} service
|
|
25
|
-
/// </summary>
|
|
26
|
-
public class {{name}}Service : I{{name}}Service
|
|
27
|
-
{
|
|
28
|
-
private readonly ILogger<{{name}}Service> _logger;
|
|
29
|
-
|
|
30
|
-
public {{name}}Service(ILogger<{{name}}Service> logger)
|
|
31
|
-
{
|
|
32
|
-
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
{{#each methods}}
|
|
36
|
-
/// <inheritdoc />
|
|
37
|
-
public async Task<object> {{this}}(CancellationToken cancellationToken = default)
|
|
38
|
-
{
|
|
39
|
-
_logger.LogInformation("Executing {{this}} in {{../name}}Service");
|
|
40
|
-
|
|
41
|
-
// TODO: Implement {{this}} logic
|
|
42
|
-
await Task.CompletedTask;
|
|
43
|
-
|
|
44
|
-
throw new NotImplementedException("{{this}} is not yet implemented");
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
{{/each}}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// ============================================================================
|
|
51
|
-
// Registration (add to DependencyInjection.cs)
|
|
52
|
-
// ============================================================================
|
|
53
|
-
// services.AddScoped<I{{name}}Service, {{name}}Service>();
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading;
|
|
3
|
+
using System.Threading.Tasks;
|
|
4
|
+
using System.Collections.Generic;
|
|
5
|
+
using Microsoft.Extensions.Logging;
|
|
6
|
+
|
|
7
|
+
namespace {{namespace}};
|
|
8
|
+
|
|
9
|
+
/// <summary>
|
|
10
|
+
/// Interface for {{name}} service operations
|
|
11
|
+
/// </summary>
|
|
12
|
+
public interface I{{name}}Service
|
|
13
|
+
{
|
|
14
|
+
{{#each methods}}
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// {{this}} operation
|
|
17
|
+
/// </summary>
|
|
18
|
+
Task<object> {{this}}(CancellationToken cancellationToken = default);
|
|
19
|
+
|
|
20
|
+
{{/each}}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/// <summary>
|
|
24
|
+
/// Implementation of {{name}} service
|
|
25
|
+
/// </summary>
|
|
26
|
+
public class {{name}}Service : I{{name}}Service
|
|
27
|
+
{
|
|
28
|
+
private readonly ILogger<{{name}}Service> _logger;
|
|
29
|
+
|
|
30
|
+
public {{name}}Service(ILogger<{{name}}Service> logger)
|
|
31
|
+
{
|
|
32
|
+
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
{{#each methods}}
|
|
36
|
+
/// <inheritdoc />
|
|
37
|
+
public async Task<object> {{this}}(CancellationToken cancellationToken = default)
|
|
38
|
+
{
|
|
39
|
+
_logger.LogInformation("Executing {{this}} in {{../name}}Service");
|
|
40
|
+
|
|
41
|
+
// TODO: Implement {{this}} logic
|
|
42
|
+
await Task.CompletedTask;
|
|
43
|
+
|
|
44
|
+
throw new NotImplementedException("{{this}} is not yet implemented");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
{{/each}}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ============================================================================
|
|
51
|
+
// Registration (add to DependencyInjection.cs)
|
|
52
|
+
// ============================================================================
|
|
53
|
+
// services.AddScoped<I{{name}}Service, {{name}}Service>();
|