Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
EShop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
EShop
Commits
21257fa6
Commit
21257fa6
authored
Apr 30, 2020
by
gdlcf88
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Data seeder for default Store and ProductType, close #15, #16
parent
954f812e
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
148 additions
and
0 deletions
+148
-0
IProductTypeDataSeeder.cs
...Abp/EShop/Products/ProductTypes/IProductTypeDataSeeder.cs
+10
-0
ProductTypeDataSeeder.cs
...yAbp/EShop/Products/ProductTypes/ProductTypeDataSeeder.cs
+31
-0
ProductsDataSeedContributor.cs
...ain/EasyAbp/EShop/Products/ProductsDataSeedContributor.cs
+24
-0
StoresSettingDefinitionProvider.cs
.../EShop/Stores/Settings/StoresSettingDefinitionProvider.cs
+2
-0
StoresSettings.cs
...es.Domain/EasyAbp/EShop/Stores/Settings/StoresSettings.cs
+2
-0
IStoreDataSeeder.cs
...es.Domain/EasyAbp/EShop/Stores/Stores/IStoreDataSeeder.cs
+10
-0
Store.cs
....EShop.Stores.Domain/EasyAbp/EShop/Stores/Stores/Store.cs
+2
-0
StoreDataSeeder.cs
...res.Domain/EasyAbp/EShop/Stores/Stores/StoreDataSeeder.cs
+43
-0
StoresDataSeedContributor.cs
....Domain/EasyAbp/EShop/Stores/StoresDataSeedContributor.cs
+24
-0
No files found.
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductTypes/IProductTypeDataSeeder.cs
0 → 100644
View file @
21257fa6
using
System.Threading.Tasks
;
using
Volo.Abp.Data
;
namespace
EasyAbp.EShop.Products.ProductTypes
{
public
interface
IProductTypeDataSeeder
{
Task
SeedAsync
(
DataSeedContext
context
);
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductTypes/ProductTypeDataSeeder.cs
0 → 100644
View file @
21257fa6
using
System.Threading.Tasks
;
using
Volo.Abp.Data
;
using
Volo.Abp.DependencyInjection
;
using
Volo.Abp.Guids
;
using
Volo.Abp.MultiTenancy
;
namespace
EasyAbp.EShop.Products.ProductTypes
{
public
class
ProductTypeDataSeeder
:
IProductTypeDataSeeder
,
ITransientDependency
{
private
readonly
IGuidGenerator
_guidGenerator
;
private
readonly
IProductTypeRepository
_productTypeRepository
;
public
ProductTypeDataSeeder
(
IGuidGenerator
guidGenerator
,
IProductTypeRepository
productTypeRepository
)
{
_guidGenerator
=
guidGenerator
;
_productTypeRepository
=
productTypeRepository
;
}
public
async
Task
SeedAsync
(
DataSeedContext
context
)
{
if
(
await
_productTypeRepository
.
GetCountAsync
()
==
0
)
{
await
_productTypeRepository
.
InsertAsync
(
new
ProductType
(
_guidGenerator
.
Create
(),
"Default"
,
"Default"
,
null
,
MultiTenancySides
.
Both
),
true
);
}
}
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductsDataSeedContributor.cs
0 → 100644
View file @
21257fa6
using
System.Threading.Tasks
;
using
EasyAbp.EShop.Products.ProductTypes
;
using
Volo.Abp.Data
;
using
Volo.Abp.DependencyInjection
;
using
Volo.Abp.Uow
;
namespace
EasyAbp.EShop.Products
{
public
class
ProductsDataSeedContributor
:
IDataSeedContributor
,
ITransientDependency
{
private
readonly
IProductTypeDataSeeder
_productTypeDataSeeder
;
public
ProductsDataSeedContributor
(
IProductTypeDataSeeder
productTypeDataSeeder
)
{
_productTypeDataSeeder
=
productTypeDataSeeder
;
}
[
UnitOfWork
(
true
)]
public
async
Task
SeedAsync
(
DataSeedContext
context
)
{
await
_productTypeDataSeeder
.
SeedAsync
(
context
);
}
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Settings/StoresSettingDefinitionProvider.cs
View file @
21257fa6
...
...
@@ -9,6 +9,8 @@ namespace EasyAbp.EShop.Stores.Settings
/* Define module settings here.
* Use names from StoresSettings class.
*/
context
.
Add
(
new
SettingDefinition
(
StoresSettings
.
DefaultProductTypeDisplayName
,
"My store"
));
}
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Settings/StoresSettings.cs
View file @
21257fa6
...
...
@@ -7,5 +7,7 @@
/* Add constants for setting names. Example:
* public const string MySettingName = GroupName + ".MySettingName";
*/
public
const
string
DefaultProductTypeDisplayName
=
GroupName
+
".DefaultProductTypeDisplayName"
;
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Stores/IStoreDataSeeder.cs
0 → 100644
View file @
21257fa6
using
System.Threading.Tasks
;
using
Volo.Abp.Data
;
namespace
EasyAbp.EShop.Stores.Stores
{
public
interface
IStoreDataSeeder
{
Task
SeedAsync
(
DataSeedContext
context
);
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Stores/Store.cs
View file @
21257fa6
...
...
@@ -18,8 +18,10 @@ namespace EasyAbp.EShop.Stores.Stores
public
Store
(
Guid
id
,
Guid
?
tenantId
,
[
NotNull
]
string
name
)
:
base
(
id
)
{
TenantId
=
tenantId
;
Name
=
name
;
}
}
...
...
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/Stores/StoreDataSeeder.cs
0 → 100644
View file @
21257fa6
using
System.Threading.Tasks
;
using
EasyAbp.EShop.Stores.Settings
;
using
Volo.Abp.Data
;
using
Volo.Abp.DependencyInjection
;
using
Volo.Abp.Guids
;
using
Volo.Abp.MultiTenancy
;
using
Volo.Abp.Settings
;
namespace
EasyAbp.EShop.Stores.Stores
{
public
class
StoreDataSeeder
:
IStoreDataSeeder
,
ITransientDependency
{
private
readonly
IGuidGenerator
_guidGenerator
;
private
readonly
ICurrentTenant
_currentTenant
;
private
readonly
ISettingProvider
_settingProvider
;
private
readonly
IStoreRepository
_storeRepository
;
public
StoreDataSeeder
(
IGuidGenerator
guidGenerator
,
ICurrentTenant
currentTenant
,
ISettingProvider
settingProvider
,
IStoreRepository
storeRepository
)
{
_guidGenerator
=
guidGenerator
;
_currentTenant
=
currentTenant
;
_settingProvider
=
settingProvider
;
_storeRepository
=
storeRepository
;
}
public
async
Task
SeedAsync
(
DataSeedContext
context
)
{
using
(
_currentTenant
.
Change
(
context
.
TenantId
))
{
if
(
await
_storeRepository
.
GetCountAsync
()
==
0
)
{
await
_storeRepository
.
InsertAsync
(
new
Store
(
_guidGenerator
.
Create
(),
_currentTenant
.
Id
,
await
_settingProvider
.
GetOrNullAsync
(
StoresSettings
.
DefaultProductTypeDisplayName
)),
true
);
}
}
}
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain/EasyAbp/EShop/Stores/StoresDataSeedContributor.cs
0 → 100644
View file @
21257fa6
using
System.Threading.Tasks
;
using
EasyAbp.EShop.Stores.Stores
;
using
Volo.Abp.Data
;
using
Volo.Abp.DependencyInjection
;
using
Volo.Abp.Uow
;
namespace
EasyAbp.EShop.Stores
{
public
class
StoresDataSeedContributor
:
IDataSeedContributor
,
ITransientDependency
{
private
readonly
IStoreDataSeeder
_storeDataSeeder
;
public
StoresDataSeedContributor
(
IStoreDataSeeder
storeDataSeeder
)
{
_storeDataSeeder
=
storeDataSeeder
;
}
[
UnitOfWork
(
true
)]
public
async
Task
SeedAsync
(
DataSeedContext
context
)
{
await
_storeDataSeeder
.
SeedAsync
(
context
);
}
}
}
\ No newline at end of file
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