Skip to content

Commit

Permalink
Upgraded to module zero 0.5.7.0. Also added a sample setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
hikalkan committed Mar 8, 2015
1 parent d28e3f8 commit 32a4764
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Collections.Generic;
using Abp.Configuration;

namespace ModuleZeroSampleProject.Configuration
{
public class MySettingProvider : SettingProvider
{
public const string QuestionsDefaultPageSize = "QuestionsDefaultPageSize";

public override IEnumerable<SettingDefinition> GetSettingDefinitions(SettingDefinitionProviderContext context)
{
return new[]
{
new SettingDefinition(QuestionsDefaultPageSize, "10")
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
<Reference Include="Abp.EntityFramework">
<HintPath>..\packages\Abp.EntityFramework.0.5.5.0\lib\net451\Abp.EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Abp.Zero, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Abp.Zero, Version=0.5.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Abp.Zero.0.5.6.0\lib\net451\Abp.Zero.dll</HintPath>
<HintPath>..\packages\Abp.Zero.0.5.7.0\lib\net451\Abp.Zero.dll</HintPath>
</Reference>
<Reference Include="AutoMapper, Version=3.3.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -104,6 +104,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Authorization\ModuleZeroSampleProjectAuthorizationProvider.cs" />
<Compile Include="Configuration\MySettingProvider.cs" />
<Compile Include="Questions\Dto\CreateQuestionInput.cs" />
<Compile Include="Questions\Dto\AnswerDto.cs" />
<Compile Include="Questions\Dto\GetQuestionsInput.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Abp.AutoMapper;
using Abp.Modules;
using ModuleZeroSampleProject.Authorization;
using ModuleZeroSampleProject.Configuration;

namespace ModuleZeroSampleProject
{
Expand All @@ -12,6 +13,7 @@ public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
Configuration.Authorization.Providers.Add<ModuleZeroSampleProjectAuthorizationProvider>();
Configuration.Settings.Providers.Add<MySettingProvider>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,13 @@ namespace ModuleZeroSampleProject.Questions.Dto
{
public class GetQuestionsInput : IInputDto, IPagedResultRequest, ISortedResultRequest, ICustomValidate
{
[Range(1, 1000)]
[Range(0, 1000)]
public int MaxResultCount { get; set; }

public int SkipCount { get; set; }

public string Sorting { get; set; }

public GetQuestionsInput()
{
MaxResultCount = 10;
}


public void AddValidationErrors(List<ValidationResult> results)
{
var validSortingValues = new[] { "CreationTime DESC", "VoteCount DESC", "ViewCount DESC", "AnswerCount DESC" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
using Abp.Application.Services.Dto;
using Abp.Authorization;
using Abp.AutoMapper;
using Abp.Configuration;
using Abp.Domain.Repositories;
using Abp.Domain.Uow;
using Abp.Linq.Extensions;
using Abp.Runtime.Session;
using Abp.UI;
using ModuleZeroSampleProject.Configuration;
using ModuleZeroSampleProject.Questions.Dto;
using ModuleZeroSampleProject.Users;

Expand All @@ -36,6 +39,11 @@ public QuestionAppService(IRepository<Question> questionRepository, IRepository<

public PagedResultOutput<QuestionDto> GetQuestions(GetQuestionsInput input)
{
if (input.MaxResultCount <= 0)
{
input.MaxResultCount = SettingManager.GetSettingValue<int>(MySettingProvider.QuestionsDefaultPageSize);
}

var questionCount = _questionRepository.Count();
var questions =
_questionRepository
Expand Down Expand Up @@ -102,7 +110,7 @@ public VoteChangeOutput VoteDown(EntityRequestInput input)
public SubmitAnswerOutput SubmitAnswer(SubmitAnswerInput input)
{
var question = _questionRepository.Get(input.QuestionId);
var currentUser = _userRepository.Get(CurrentSession.UserId.Value);
var currentUser = _userRepository.Get(CurrentSession.GetUserId());

question.AnswerCount++;

Expand Down
2 changes: 1 addition & 1 deletion sample/ModuleZeroSampleProject.Application/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<package id="Abp" version="0.5.5.0" targetFramework="net451" />
<package id="Abp.AutoMapper" version="0.5.5.0" targetFramework="net451" />
<package id="Abp.EntityFramework" version="0.5.5.0" targetFramework="net451" />
<package id="Abp.Zero" version="0.5.6.0" targetFramework="net451" />
<package id="Abp.Zero" version="0.5.7.0" targetFramework="net451" />
<package id="AutoMapper" version="3.3.1" targetFramework="net451" />
<package id="Castle.Core" version="3.3.3" targetFramework="net451" />
<package id="Castle.LoggingFacility" version="3.3.0" targetFramework="net451" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
<Reference Include="Abp">
<HintPath>..\packages\Abp.0.5.5.0\lib\net451\Abp.dll</HintPath>
</Reference>
<Reference Include="Abp.Zero, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Abp.Zero, Version=0.5.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Abp.Zero.0.5.6.0\lib\net451\Abp.Zero.dll</HintPath>
<HintPath>..\packages\Abp.Zero.0.5.7.0\lib\net451\Abp.Zero.dll</HintPath>
</Reference>
<Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
17 changes: 14 additions & 3 deletions sample/ModuleZeroSampleProject.Core/Users/UserManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Abp.Authorization.Users;
using Abp.Authorization;
using Abp.Authorization.Users;
using Abp.Domain.Repositories;
using Abp.Zero.Configuration;
using ModuleZeroSampleProject.Authorization;
Expand All @@ -8,8 +9,18 @@ namespace ModuleZeroSampleProject.Users
{
public class UserManager : AbpUserManager<Tenant, Role, User>
{
public UserManager(UserStore store, RoleManager roleManager, IRepository<Tenant> tenantRepository, MultiTenancyConfig multiTenancyConfig)
: base(store, roleManager, tenantRepository, multiTenancyConfig)
public UserManager(
UserStore store,
RoleManager roleManager,
IRepository<Tenant> tenantRepository,
MultiTenancyConfig multiTenancyConfig,
IPermissionManager permissionManager)
: base(
store,
roleManager,
tenantRepository,
multiTenancyConfig,
permissionManager)
{
}
}
Expand Down
2 changes: 2 additions & 0 deletions sample/ModuleZeroSampleProject.Core/Users/UserStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ public UserStore(
IRepository<UserLogin, long> userLoginRepository,
IRepository<UserRole, long> userRoleRepository,
IRepository<Role> roleRepository,
IRepository<UserPermissionSetting, long> userPermissionSettingRepository,
IAbpSession session)
: base(
userRepository,
userLoginRepository,
userRoleRepository,
roleRepository,
userPermissionSettingRepository,
session)
{
}
Expand Down
2 changes: 1 addition & 1 deletion sample/ModuleZeroSampleProject.Core/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Abp" version="0.5.5.0" targetFramework="net451" />
<package id="Abp.Zero" version="0.5.6.0" targetFramework="net451" />
<package id="Abp.Zero" version="0.5.7.0" targetFramework="net451" />
<package id="Castle.Core" version="3.3.3" targetFramework="net451" />
<package id="Castle.LoggingFacility" version="3.3.0" targetFramework="net451" />
<package id="Castle.Windsor" version="3.3.0" targetFramework="net451" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
<Reference Include="Abp.EntityFramework">
<HintPath>..\packages\Abp.EntityFramework.0.5.5.0\lib\net451\Abp.EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Abp.Zero, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Abp.Zero, Version=0.5.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Abp.Zero.0.5.6.0\lib\net451\Abp.Zero.dll</HintPath>
<HintPath>..\packages\Abp.Zero.0.5.7.0\lib\net451\Abp.Zero.dll</HintPath>
</Reference>
<Reference Include="Abp.Zero.EntityFramework, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Abp.Zero.EntityFramework, Version=0.5.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Abp.Zero.EntityFramework.0.5.6.0\lib\net451\Abp.Zero.EntityFramework.dll</HintPath>
<HintPath>..\packages\Abp.Zero.EntityFramework.0.5.7.0\lib\net451\Abp.Zero.EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<packages>
<package id="Abp" version="0.5.5.0" targetFramework="net451" />
<package id="Abp.EntityFramework" version="0.5.5.0" targetFramework="net451" />
<package id="Abp.Zero" version="0.5.6.0" targetFramework="net451" />
<package id="Abp.Zero.EntityFramework" version="0.5.6.0" targetFramework="net451" />
<package id="Abp.Zero" version="0.5.7.0" targetFramework="net451" />
<package id="Abp.Zero.EntityFramework" version="0.5.7.0" targetFramework="net451" />
<package id="Castle.Core" version="3.3.3" targetFramework="net451" />
<package id="Castle.LoggingFacility" version="3.3.0" targetFramework="net451" />
<package id="Castle.Windsor" version="3.3.0" targetFramework="net451" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
abp.ui.setBusy(
null,
questionService.getQuestions({
maxResultCount: 10,
skipCount: skipCount,
sorting: vm.sorting
}).success(function (data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@
<Reference Include="Abp.Web.Mvc">
<HintPath>..\packages\Abp.Web.Mvc.0.5.5.0\lib\net451\Abp.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="Abp.Zero, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Abp.Zero, Version=0.5.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Abp.Zero.0.5.6.0\lib\net451\Abp.Zero.dll</HintPath>
<HintPath>..\packages\Abp.Zero.0.5.7.0\lib\net451\Abp.Zero.dll</HintPath>
</Reference>
<Reference Include="Abp.Zero.EntityFramework, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Abp.Zero.EntityFramework, Version=0.5.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Abp.Zero.EntityFramework.0.5.6.0\lib\net451\Abp.Zero.EntityFramework.dll</HintPath>
<HintPath>..\packages\Abp.Zero.EntityFramework.0.5.7.0\lib\net451\Abp.Zero.EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Antlr3.Runtime">
<HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
Expand Down
4 changes: 2 additions & 2 deletions sample/ModuleZeroSampleProject.Web/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<package id="Abp.Web.Api" version="0.5.5.0" targetFramework="net451" />
<package id="Abp.Web.Mvc" version="0.5.5.0" targetFramework="net451" />
<package id="Abp.Web.Resources" version="0.5.5.0" targetFramework="net451" />
<package id="Abp.Zero" version="0.5.6.0" targetFramework="net451" />
<package id="Abp.Zero.EntityFramework" version="0.5.6.0" targetFramework="net451" />
<package id="Abp.Zero" version="0.5.7.0" targetFramework="net451" />
<package id="Abp.Zero.EntityFramework" version="0.5.7.0" targetFramework="net451" />
<package id="Angular.UI.Bootstrap" version="0.12.0" targetFramework="net451" />
<package id="Angular.UI.Utils" version="0.1.1" targetFramework="net451" />
<package id="Antlr" version="3.5.0.2" targetFramework="net451" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
<Reference Include="Abp.TestBase">
<HintPath>..\..\packages\Abp.TestBase.0.1.3.0\lib\net451\Abp.TestBase.dll</HintPath>
</Reference>
<Reference Include="Abp.Zero, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Abp.Zero, Version=0.5.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Abp.Zero.0.5.6.0\lib\net451\Abp.Zero.dll</HintPath>
<HintPath>..\..\packages\Abp.Zero.0.5.7.0\lib\net451\Abp.Zero.dll</HintPath>
</Reference>
<Reference Include="Abp.Zero.EntityFramework, Version=0.5.6.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Abp.Zero.EntityFramework, Version=0.5.7.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Abp.Zero.EntityFramework.0.5.6.0\lib\net451\Abp.Zero.EntityFramework.dll</HintPath>
<HintPath>..\..\packages\Abp.Zero.EntityFramework.0.5.7.0\lib\net451\Abp.Zero.EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Castle.Core">
<HintPath>..\..\packages\Castle.Core.3.3.0\lib\net45\Castle.Core.dll</HintPath>
Expand Down
4 changes: 2 additions & 2 deletions sample/Tests/ModuleZeroSampleProject.Tests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<package id="Abp" version="0.5.5.0" targetFramework="net451" />
<package id="Abp.EntityFramework" version="0.5.5.0" targetFramework="net451" />
<package id="Abp.TestBase" version="0.1.3.0" targetFramework="net451" />
<package id="Abp.Zero" version="0.5.6.0" targetFramework="net451" />
<package id="Abp.Zero.EntityFramework" version="0.5.6.0" targetFramework="net451" />
<package id="Abp.Zero" version="0.5.7.0" targetFramework="net451" />
<package id="Abp.Zero.EntityFramework" version="0.5.7.0" targetFramework="net451" />
<package id="Castle.Core" version="3.3.0" targetFramework="net451" />
<package id="Castle.LoggingFacility" version="3.3.0" targetFramework="net451" />
<package id="Castle.Windsor" version="3.3.0" targetFramework="net451" />
Expand Down

0 comments on commit 32a4764

Please sign in to comment.