File tree Expand file tree Collapse file tree 5 files changed +9
-34
lines changed Expand file tree Collapse file tree 5 files changed +9
-34
lines changed Original file line number Diff line number Diff line change 18
18
<GenerateAssemblyVersionAttribute >false</GenerateAssemblyVersionAttribute >
19
19
<GenerateAssemblyFileVersionAttribute >false</GenerateAssemblyFileVersionAttribute >
20
20
<GenerateAssemblyInformationalVersionAttribute >false</GenerateAssemblyInformationalVersionAttribute >
21
- </PropertyGroup >
21
+ </PropertyGroup >
22
22
<ItemGroup >
23
23
<PackageReference Include =" Autofac" Version =" 4.8.1" />
24
24
<PackageReference Include =" FluentValidation" Version =" 7.5.2" />
25
25
<PackageReference Include =" Microsoft.Extensions.Logging.Abstractions" Version =" 2.1.0-rc1-final" />
26
26
<PackageReference Include =" Microsoft.Extensions.Options" Version =" 2.1.0-rc1-final" />
27
27
<PackageReference Include =" Microsoft.Extensions.Options.ConfigurationExtensions" Version =" 2.1.0-rc1-final" />
28
- <PackageReference Include =" MongoDB.Driver" Version =" 2.6.0" />
28
+ <PackageReference Include =" MongoDB.Driver" Version =" 2.6.0" />
29
29
<PackageReference Include =" Newtonsoft.Json" Version =" 11.0.2" />
30
30
<PackageReference Include =" Serilog.Sinks.Console" Version =" 3.1.1" />
31
31
<PackageReference Include =" System.ComponentModel.Annotations" Version =" 4.5.0-rc1" />
Original file line number Diff line number Diff line change @@ -80,13 +80,9 @@ public virtual async Task<bool> DeleteAllAsync()
80
80
return true ;
81
81
}
82
82
83
- public virtual Task < List < TModel > > GetAllAsync ( bool onlyActive = true )
83
+ public virtual Task < List < TModel > > GetAllAsync ( )
84
84
{
85
- Task < List < TModel > > results ;
86
- if ( onlyActive )
87
- results = GetCollection ( ) . Find ( x => x . IsActive ) . ToListAsync ( ) ;
88
- else
89
- results = GetCollection ( ) . Find ( model => true ) . ToListAsync ( ) ;
85
+ var results = GetCollection ( ) . Find ( model => true ) . ToListAsync ( ) ;
90
86
91
87
return results ;
92
88
}
@@ -102,11 +98,7 @@ public virtual async Task<TModel> SaveAsync(TModel item)
102
98
{
103
99
if ( item . Id != Guid . Empty )
104
100
item . UpdatedDate = DateTime . UtcNow ;
105
-
106
- if ( item . OwnerUserId == null || item . OwnerUserId == Guid . Empty )
107
- if ( CurrentContext != null && CurrentContext . CurrentUserId != Guid . Empty )
108
- item . OwnerUserId = CurrentContext . CurrentUserId ;
109
-
101
+
110
102
var errors = await ValidateObject ( item ) ;
111
103
112
104
if ( errors . Any ( ) )
@@ -150,9 +142,9 @@ public virtual Task<bool> DeleteAsync(TModel item)
150
142
/// <summary>
151
143
/// Configures the indexes.
152
144
/// </summary>
153
- public virtual async Task ConfigureIndexes ( )
145
+ public virtual Task ConfigureIndexes ( )
154
146
{
155
- await CreateIndex ( "Id" , Builders < TModel > . IndexKeys . Ascending ( x => x . Id ) . Ascending ( x => x . IsActive ) ) ;
147
+ return Task . Run ( ( ) => { } ) ;
156
148
}
157
149
158
150
/// <summary>
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ public interface IBaseRepository<T> : IBaseRepository
9
9
where T : BaseDocument
10
10
{
11
11
Task < bool > DeleteAllAsync ( ) ;
12
- Task < List < T > > GetAllAsync ( bool onlyActive = true ) ;
12
+ Task < List < T > > GetAllAsync ( ) ;
13
13
Task < T > GetOneAsync ( Guid id ) ;
14
14
Task < T > SaveAsync ( T item ) ;
15
15
Task < bool > DeleteAsync ( Guid id ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ public abstract class BaseDocument
12
12
protected BaseDocument ( )
13
13
{
14
14
ValidationErrors = new List < ValidationResult > ( ) ;
15
- IsActive = true ;
16
15
}
17
16
18
17
[ BsonId ( IdGenerator = typeof ( CombGuidGenerator ) ) ]
@@ -27,10 +26,7 @@ protected BaseDocument()
27
26
public DateTimeOffset ? CreatedDate { get ; set ; } = DateTime . UtcNow ;
28
27
29
28
public DateTimeOffset ? UpdatedDate { get ; set ; } = DateTime . UtcNow ;
30
-
31
- public Guid ? OwnerUserId { get ; set ; }
32
- public bool IsActive { get ; set ; }
33
-
29
+
34
30
[ JsonIgnore ]
35
31
[ BsonIgnore ]
36
32
public List < ValidationResult > ValidationErrors { get ; set ; }
You can’t perform that action at this time.
0 commit comments