Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
丁松杰
/
Pole
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b615a32a
authored
5 years ago
by
dingsongjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除不必要的类
parent
d94f3747
master
…
v1.0.0
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
24 additions
and
220 deletions
src/Pole.Orleans.Provider.EntityframeworkCore/Context/ConfigureEntryStateDelegate.cs
src/Pole.Orleans.Provider.EntityframeworkCore/Context/GrainStorageContext.cs
src/Pole.Orleans.Provider.EntityframeworkCore/Conventions/GetCompoundKeyDelegate.cs
src/Pole.Orleans.Provider.EntityframeworkCore/Exceptions/GrainStorageConfigurationException.cs
src/Pole.Orleans.Provider.EntityframeworkCore/Extensions/GrainStorageOptionsExtensions.cs
src/Pole.Orleans.Provider.EntityframeworkCore/Extensions/GrainStorageServiceCollectionExtensions.cs
src/Pole.Orleans.Provider.EntityframeworkCore/Extensions/GrainStorageSiloHostBuilderExtensions.cs
src/Pole.Orleans.Provider.EntityframeworkCore/GrainStorageConfigurationException.cs
src/Pole.Orleans.Provider.EntityframeworkCore/GrainStorageOptionsExtensions.cs
src/Pole.Orleans.Provider.EntityframeworkCore/GrainStorageServiceCollectionExtensions.cs
src/Pole.Orleans.Provider.EntityframeworkCore/GrainStorageSiloHostBuilderExtensions.cs
src/Pole.Orleans.Provider.EntityframeworkCore/ReadWriteStateAsyncDelegate.cs
src/Pole.Orleans.Provider.EntityframeworkCore/Context/ConfigureEntryStateDelegate.cs
deleted
100644 → 0
View file @
d94f3747
using
Microsoft.EntityFrameworkCore.ChangeTracking
;
namespace
Orleans.Providers.EntityFramework
{
public
delegate
void
ConfigureEntryStateDelegate
<
TGrainState
>(
EntityEntry
<
TGrainState
>
entry
)
where
TGrainState
:
class
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/Pole.Orleans.Provider.EntityframeworkCore/Context/GrainStorageContext.cs
deleted
100644 → 0
View file @
d94f3747
using
System.Threading
;
namespace
Orleans.Providers.EntityFramework
{
/// <summary>
/// An async local context to apply modifications to current behavior of write and clear operations.
/// </summary>
/// <typeparam name="TEntity"></typeparam>
public
static
class
GrainStorageContext
<
TEntity
>
where
TEntity
:
class
{
// ReSharper disable once StaticMemberInGenericType
private
static
readonly
AsyncLocal
<
bool
>
IsConfiguredLocal
=
new
AsyncLocal
<
bool
>();
private
static
readonly
AsyncLocal
<
ConfigureEntryStateDelegate
<
TEntity
>>
ConfigureStateDelegateLocal
=
new
AsyncLocal
<
ConfigureEntryStateDelegate
<
TEntity
>>();
internal
static
bool
IsConfigured
=>
IsConfiguredLocal
.
Value
;
internal
static
ConfigureEntryStateDelegate
<
TEntity
>
ConfigureStateDelegate
=>
ConfigureStateDelegateLocal
.
Value
;
/// <summary>
/// Configures the entry state.
/// Use it to modify what gets changed during the write operations.
/// </summary>
/// <param name="configureState">The delegate to be called before saving context's state.</param>
public
static
void
ConfigureEntryState
(
ConfigureEntryStateDelegate
<
TEntity
>
configureState
)
{
ConfigureStateDelegateLocal
.
Value
=
configureState
;
IsConfiguredLocal
.
Value
=
true
;
}
public
static
void
Clear
()
{
ConfigureStateDelegateLocal
.
Value
=
null
;
IsConfiguredLocal
.
Value
=
false
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/Pole.Orleans.Provider.EntityframeworkCore/Conventions/GetCompoundKeyDelegate.cs
deleted
100644 → 0
View file @
d94f3747
using
System
;
using
Orleans.Runtime
;
namespace
Orleans.Providers.EntityFramework.Conventions
{
public
delegate
ValueType
GetCompoundKeyDelegate
(
IAddressable
addressable
,
out
string
keyExt
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/Pole.Orleans.Provider.EntityframeworkCore/Exceptions/GrainStorageConfigurationException.cs
View file @
b615a32a
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Orleans.Providers.EntityFramework.Exceptions
namespace
Pole.Orleans.Provider.EntityframeworkCore
{
{
// todo: Use for configuration errors
// todo: Use for configuration errors
public
class
GrainStorageConfigurationException
:
Exception
public
class
GrainStorageConfigurationException
:
Exception
...
...
This diff is collapsed.
Click to expand it.
src/Pole.Orleans.Provider.EntityframeworkCore/Extensions/GrainStorageOptionsExtensions.cs
View file @
b615a32a
using
System
;
using
Microsoft.EntityFrameworkCore
;
using
Orleans.Runtime
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Linq.Expressions
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Microsoft.EntityFrameworkCore
;
using
Orleans.Runtime
;
using
Pole.Orleans.Provider.EntityframeworkCore
;
namespace
Orleans.Providers.EntityFramework.Extensions
namespace
Pole.Orleans.Provider.EntityframeworkCore
{
{
public
static
class
GrainStorageOptionsExtensions
public
static
class
GrainStorageOptionsExtensions
{
{
public
static
GrainStorageOptions
<
TContext
,
TGrain
,
TGrainState
>
UseQuery
<
TContext
,
TGrain
,
TGrainState
>(
public
static
GrainStorageOptions
<
TContext
,
TGrain
,
TGrainState
>
UseQuery
<
TContext
,
TGrain
,
TGrainState
>(
this
GrainStorageOptions
<
TContext
,
TGrain
,
TGrainState
>
options
,
this
GrainStorageOptions
<
TContext
,
TGrain
,
TGrainState
>
options
,
Func
<
TContext
,
IQueryable
<
TGrainState
>>
queryFunc
)
Func
<
TContext
,
IQueryable
<
TGrainState
>>
queryFunc
)
where
TContext
:
DbContext
where
TContext
:
DbContext
where
TGrainState
:
class
where
TGrainState
:
class
{
{
...
...
This diff is collapsed.
Click to expand it.
src/Pole.Orleans.Provider.EntityframeworkCore/Extensions/GrainStorageServiceCollectionExtensions.cs
View file @
b615a32a
using
System
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.DependencyInjection.Extensions
;
using
Microsoft.Extensions.DependencyInjection.Extensions
;
using
Microsoft.Extensions.Options
;
using
Microsoft.Extensions.Options
;
using
Orleans.Providers.EntityFramework.Conventions
;
using
Orleans
;
using
Orleans.Providers
;
using
Orleans.Runtime
;
using
Orleans.Runtime
;
using
Orleans.Storage
;
using
Orleans.Storage
;
using
Pole.Orleans.Provider.EntityframeworkCore
;
using
Pole.Orleans.Provider.EntityframeworkCore.Conventions
;
using
Pole.Orleans.Provider.EntityframeworkCore.Conventions
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Orleans.Providers.EntityFramework.Extensions
namespace
Pole.Orleans.Provider.EntityframeworkCore
{
{
public
static
class
GrainStorageServiceCollectionExtensions
public
static
class
GrainStorageServiceCollectionExtensions
{
{
...
...
This diff is collapsed.
Click to expand it.
src/Pole.Orleans.Provider.EntityframeworkCore/Extensions/GrainStorageSiloHostBuilderExtensions.cs
View file @
b615a32a
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore
;
using
Orleans.Hosting
;
using
Orleans.Hosting
;
using
Orleans.Providers
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Orleans.Providers.EntityFramework.Extensions
namespace
Pole.Orleans.Provider.EntityframeworkCore
{
{
public
static
class
GrainStorageSiloHostBuilderExtensions
public
static
class
GrainStorageSiloHostBuilderExtensions
{
{
...
@@ -15,13 +19,10 @@ namespace Orleans.Providers.EntityFramework.Extensions
...
@@ -15,13 +19,10 @@ namespace Orleans.Providers.EntityFramework.Extensions
string
providerName
)
string
providerName
)
where
TContext
:
DbContext
where
TContext
:
DbContext
{
{
return
builder
return
builder
.
ConfigureServices
(
services
=>
.
ConfigureServices
(
services
=>
{
services
.
AddEfGrainStorage
<
TContext
>(
providerName
);
});
{
services
.
AddEfGrainStorage
<
TContext
>(
providerName
);
});
}
}
public
static
ISiloBuilder
AddEfGrainStorageAsDefault
<
TContext
>(
this
ISiloBuilder
builder
)
public
static
ISiloBuilder
AddEfGrainStorageAsDefault
<
TContext
>(
this
ISiloBuilder
builder
)
where
TContext
:
DbContext
where
TContext
:
DbContext
{
{
...
...
This diff is collapsed.
Click to expand it.
src/Pole.Orleans.Provider.EntityframeworkCore/GrainStorageConfigurationException.cs
deleted
100644 → 0
View file @
d94f3747
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Pole.Orleans.Provider.EntityframeworkCore
{
// todo: Use for configuration errors
public
class
GrainStorageConfigurationException
:
Exception
{
public
GrainStorageConfigurationException
()
{
}
public
GrainStorageConfigurationException
(
string
message
)
:
base
(
message
)
{
}
public
GrainStorageConfigurationException
(
string
message
,
Exception
innerException
)
:
base
(
message
,
innerException
)
{
}
}
}
This diff is collapsed.
Click to expand it.
src/Pole.Orleans.Provider.EntityframeworkCore/GrainStorageOptionsExtensions.cs
deleted
100644 → 0
View file @
d94f3747
This diff is collapsed.
Click to expand it.
src/Pole.Orleans.Provider.EntityframeworkCore/GrainStorageServiceCollectionExtensions.cs
deleted
100644 → 0
View file @
d94f3747
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.DependencyInjection.Extensions
;
using
Microsoft.Extensions.Options
;
using
Orleans
;
using
Orleans.Providers
;
using
Orleans.Runtime
;
using
Orleans.Storage
;
using
Pole.Orleans.Provider.EntityframeworkCore.Conventions
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Pole.Orleans.Provider.EntityframeworkCore
{
public
static
class
GrainStorageServiceCollectionExtensions
{
public
static
IServiceCollection
ConfigureGrainStorageOptions
<
TContext
,
TGrain
,
TEntity
>(
this
IServiceCollection
services
,
Action
<
GrainStorageOptions
<
TContext
,
TGrain
,
TEntity
>>
configureOptions
=
null
)
where
TContext
:
DbContext
where
TGrain
:
Grain
<
TEntity
>
where
TEntity
:
class
,
new
()
{
return
services
.
AddSingleton
<
IPostConfigureOptions
<
GrainStorageOptions
<
TContext
,
TGrain
,
TEntity
>>,
GrainStoragePostConfigureOptions
<
TContext
,
TGrain
,
TEntity
,
TEntity
>>()
.
Configure
<
GrainStorageOptions
<
TContext
,
TGrain
,
TEntity
>>(
typeof
(
TGrain
).
FullName
,
options
=>
{
configureOptions
?.
Invoke
(
options
);
});
}
public
static
IServiceCollection
ConfigureGrainStorageOptions
<
TContext
,
TGrain
,
TGrainState
,
TEntity
>(
this
IServiceCollection
services
,
Action
<
GrainStorageOptions
<
TContext
,
TGrain
,
TEntity
>>
configureOptions
=
null
)
where
TContext
:
DbContext
where
TGrain
:
Grain
<
TGrainState
>
where
TGrainState
:
new
()
where
TEntity
:
class
{
return
services
.
AddSingleton
<
IPostConfigureOptions
<
GrainStorageOptions
<
TContext
,
TGrain
,
TEntity
>>,
GrainStoragePostConfigureOptions
<
TContext
,
TGrain
,
TGrainState
,
TEntity
>>()
.
Configure
<
GrainStorageOptions
<
TContext
,
TGrain
,
TEntity
>>(
typeof
(
TGrain
).
FullName
,
options
=>
{
configureOptions
?.
Invoke
(
options
);
});
}
public
static
IServiceCollection
AddEfGrainStorage
<
TContext
>(
this
IServiceCollection
services
,
string
providerName
=
ProviderConstants
.
DEFAULT_STORAGE_PROVIDER_NAME
)
where
TContext
:
DbContext
{
services
.
TryAddSingleton
(
typeof
(
IEntityTypeResolver
),
typeof
(
EntityTypeResolver
));
services
.
TryAddSingleton
(
typeof
(
IGrainStorageConvention
),
typeof
(
GrainStorageConvention
));
services
.
TryAddSingleton
(
typeof
(
IGrainStateEntryConfigurator
<,,>),
typeof
(
DefaultGrainStateEntryConfigurator
<,,>));
services
.
AddSingleton
(
typeof
(
EntityFrameworkGrainStorage
<
TContext
>));
services
.
TryAddSingleton
<
IGrainStorage
>(
sp
=>
sp
.
GetServiceByName
<
IGrainStorage
>(
ProviderConstants
.
DEFAULT_STORAGE_PROVIDER_NAME
));
services
.
AddSingletonNamedService
<
IGrainStorage
>(
providerName
,
(
sp
,
name
)
=>
sp
.
GetRequiredService
<
EntityFrameworkGrainStorage
<
TContext
>>());
return
services
;
}
}
}
This diff is collapsed.
Click to expand it.
src/Pole.Orleans.Provider.EntityframeworkCore/GrainStorageSiloHostBuilderExtensions.cs
deleted
100644 → 0
View file @
d94f3747
using
Microsoft.EntityFrameworkCore
;
using
Orleans.Hosting
;
using
Orleans.Providers
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Pole.Orleans.Provider.EntityframeworkCore
{
public
static
class
GrainStorageSiloHostBuilderExtensions
{
public
static
ISiloHostBuilder
AddEfGrainStorageAsDefault
<
TContext
>(
this
ISiloHostBuilder
builder
)
where
TContext
:
DbContext
{
return
builder
.
AddEfGrainStorage
<
TContext
>(
ProviderConstants
.
DEFAULT_STORAGE_PROVIDER_NAME
);
}
public
static
ISiloHostBuilder
AddEfGrainStorage
<
TContext
>(
this
ISiloHostBuilder
builder
,
string
providerName
)
where
TContext
:
DbContext
{
return
builder
.
ConfigureServices
(
services
=>
{
services
.
AddEfGrainStorage
<
TContext
>(
providerName
);
});
}
public
static
ISiloBuilder
AddEfGrainStorageAsDefault
<
TContext
>(
this
ISiloBuilder
builder
)
where
TContext
:
DbContext
{
return
builder
.
AddEfGrainStorage
<
TContext
>(
ProviderConstants
.
DEFAULT_STORAGE_PROVIDER_NAME
);
}
public
static
ISiloBuilder
AddEfGrainStorage
<
TContext
>(
this
ISiloBuilder
builder
,
string
providerName
)
where
TContext
:
DbContext
{
return
builder
.
ConfigureServices
(
services
=>
{
services
.
AddEfGrainStorage
<
TContext
>(
providerName
);
});
}
}
}
This diff is collapsed.
Click to expand it.
src/Pole.Orleans.Provider.EntityframeworkCore/ReadWriteStateAsyncDelegate.cs
deleted
100644 → 0
View file @
d94f3747
using
System.Threading.Tasks
;
using
Orleans.Runtime
;
namespace
Orleans.Providers.EntityFramework
{
internal
delegate
Task
ReadWriteStateAsyncDelegate
(
string
grainType
,
GrainReference
grainReference
,
IGrainState
grainState
,
object
storageOptions
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment