Skip to content

Commit d21cf11

Browse files
committed
Added Core project and localization files.
1 parent 13af2dc commit d21cf11

File tree

11 files changed

+179
-14
lines changed

11 files changed

+179
-14
lines changed

AbpCompanyName.AbpProjectName.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1212
EndProject
1313
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AbpCompanyName.AbpProjectName.Web", "src\AbpCompanyName.AbpProjectName.Web\AbpCompanyName.AbpProjectName.Web.xproj", "{A2213374-BB48-48FD-BBD4-81E6A961D866}"
1414
EndProject
15+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AbpCompanyName.AbpProjectName.Core", "src\AbpCompanyName.AbpProjectName.Core\AbpCompanyName.AbpProjectName.Core.xproj", "{0FA75A5B-AB83-4FD0-B545-279774C01E87}"
16+
EndProject
1517
Global
1618
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1719
Debug|Any CPU = Debug|Any CPU
@@ -22,11 +24,16 @@ Global
2224
{A2213374-BB48-48FD-BBD4-81E6A961D866}.Debug|Any CPU.Build.0 = Debug|Any CPU
2325
{A2213374-BB48-48FD-BBD4-81E6A961D866}.Release|Any CPU.ActiveCfg = Release|Any CPU
2426
{A2213374-BB48-48FD-BBD4-81E6A961D866}.Release|Any CPU.Build.0 = Release|Any CPU
27+
{0FA75A5B-AB83-4FD0-B545-279774C01E87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
28+
{0FA75A5B-AB83-4FD0-B545-279774C01E87}.Debug|Any CPU.Build.0 = Debug|Any CPU
29+
{0FA75A5B-AB83-4FD0-B545-279774C01E87}.Release|Any CPU.ActiveCfg = Release|Any CPU
30+
{0FA75A5B-AB83-4FD0-B545-279774C01E87}.Release|Any CPU.Build.0 = Release|Any CPU
2531
EndGlobalSection
2632
GlobalSection(SolutionProperties) = preSolution
2733
HideSolutionNode = FALSE
2834
EndGlobalSection
2935
GlobalSection(NestedProjects) = preSolution
3036
{A2213374-BB48-48FD-BBD4-81E6A961D866} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC}
37+
{0FA75A5B-AB83-4FD0-B545-279774C01E87} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC}
3138
EndGlobalSection
3239
EndGlobal
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
</PropertyGroup>
7+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
8+
<PropertyGroup Label="Globals">
9+
<ProjectGuid>0fa75a5b-ab83-4fd0-b545-279774c01e87</ProjectGuid>
10+
<RootNamespace>AbpCompanyName.AbpProjectName</RootNamespace>
11+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
12+
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
13+
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
14+
</PropertyGroup>
15+
<PropertyGroup>
16+
<SchemaVersion>2.0</SchemaVersion>
17+
</PropertyGroup>
18+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
19+
</Project>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Reflection;
2+
using Abp.Localization;
3+
using Abp.Localization.Dictionaries;
4+
using Abp.Localization.Dictionaries.Json;
5+
using Abp.Modules;
6+
7+
namespace AbpCompanyName.AbpProjectName
8+
{
9+
public class AbpProjectNameCoreModule : AbpModule
10+
{
11+
public override void PreInitialize()
12+
{
13+
Configuration.Auditing.IsEnabledForAnonymousUsers = true;
14+
15+
Configuration.Localization.Languages.Add(new LanguageInfo("en", "English", isDefault: true));
16+
Configuration.Localization.Languages.Add(new LanguageInfo("tr", "Türkçe"));
17+
18+
Configuration.Localization.Sources.Add(
19+
new DictionaryBasedLocalizationSource("AbpAspNetCoreDemoModule",
20+
new JsonEmbeddedFileLocalizationDictionaryProvider(
21+
Assembly.GetExecutingAssembly(),
22+
"AbpCompanyName.AbpProjectName.Core.Localization.SourceFiles"
23+
)
24+
)
25+
);
26+
}
27+
28+
public override void Initialize()
29+
{
30+
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
31+
}
32+
}
33+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"culture": "tr",
3+
"texts": {
4+
"HelloWorld": "Merhaba Dünya!"
5+
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"culture": "en",
3+
"texts": {
4+
"HelloWorld": "Hello World!"
5+
}
6+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyConfiguration("")]
9+
[assembly: AssemblyCompany("")]
10+
[assembly: AssemblyProduct("AbpCompanyName.AbpProjectName.Core")]
11+
[assembly: AssemblyTrademark("")]
12+
13+
// Setting ComVisible to false makes the types in this assembly not visible
14+
// to COM components. If you need to access a type in this assembly from
15+
// COM, set the ComVisible attribute to true on that type.
16+
[assembly: ComVisible(false)]
17+
18+
// The following GUID is for the ID of the typelib if this project is exposed to COM
19+
[assembly: Guid("0fa75a5b-ab83-4fd0-b545-279774c01e87")]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "1.0.0.0-*",
3+
4+
"dependencies": {
5+
"Abp": "0.9.4.0-*"
6+
},
7+
8+
"frameworks": {
9+
"net452": {
10+
}
11+
},
12+
13+
"buildOptions": {
14+
"embed": {
15+
"include": [
16+
"Localization/SourceFiles/*.json"
17+
]
18+
}
19+
}
20+
}

src/AbpCompanyName.AbpProjectName.Web/AbpAspNetCoreDemoModule.cs renamed to src/AbpCompanyName.AbpProjectName.Web/AbpProjectNameWebModule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace AbpCompanyName.AbpProjectName.Web
66
{
7-
[DependsOn(typeof(AbpAspNetCoreModule))]
7+
[DependsOn(typeof(AbpProjectNameCoreModule), typeof(AbpAspNetCoreModule))]
88
public class AbpProjectNameWebModule : AbpModule
99
{
1010
public override void PreInitialize()

src/AbpCompanyName.AbpProjectName.Web/Startup.cs

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
using System;
22
using Abp.AspNetCore;
3-
using Abp.AspNetCore.Mvc.Filters;
3+
using Abp.AspNetCore.Mvc.Auditing;
4+
using Abp.AspNetCore.Mvc.Authorization;
5+
using Abp.AspNetCore.Mvc.ExceptionHandling;
6+
using Abp.AspNetCore.Mvc.Results;
7+
using Abp.AspNetCore.Mvc.Validation;
48
using Castle.Facilities.Logging;
59
using Microsoft.AspNetCore.Builder;
610
using Microsoft.AspNetCore.Hosting;
711
using Microsoft.AspNetCore.Http;
812
using Microsoft.AspNetCore.Mvc.Formatters;
913
using Microsoft.AspNetCore.Mvc.Infrastructure;
14+
using Microsoft.Extensions.Configuration;
1015
using Microsoft.Extensions.DependencyInjection;
1116
using Microsoft.Extensions.DependencyInjection.Extensions;
1217
using Microsoft.Extensions.Logging;
@@ -17,10 +22,17 @@ namespace AbpCompanyName.AbpProjectName.Web
1722
{
1823
public class Startup : AbpStartup
1924
{
20-
public Startup(IHostingEnvironment env, bool initialize = true)
21-
: base(env, initialize)
25+
public IConfigurationRoot Configuration { get; }
26+
27+
public Startup(IHostingEnvironment env)
28+
: base(env)
2229
{
23-
30+
var builder = new ConfigurationBuilder()
31+
.SetBasePath(env.ContentRootPath)
32+
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
33+
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
34+
.AddEnvironmentVariables();
35+
Configuration = builder.Build();
2436
}
2537

2638
protected override void InitializeAbp()
@@ -38,14 +50,18 @@ public override IServiceProvider ConfigureServices(IServiceCollection services)
3850
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
3951
services.TryAddSingleton<IActionContextAccessor, ActionContextAccessor>();
4052

53+
//services.AddDbContext<MyDbContext>(
54+
// options => options.UseSqlServer(Configuration.GetConnectionString("Default"))
55+
//);
56+
4157
// Add framework services.
4258
services.AddMvc(options =>
4359
{
44-
options.Filters.Add(typeof(AbpAuthorizationFilter));
45-
options.Filters.Add(typeof(AbpExeptionFilter));
46-
options.Filters.Add(typeof(AbpResultFilter));
47-
48-
//TODO: InputFotmatter!
60+
options.Filters.AddService(typeof(AbpAuthorizationFilter));
61+
options.Filters.AddService(typeof(AbpAuditActionFilter));
62+
options.Filters.AddService(typeof(AbpValidationActionFilter));
63+
options.Filters.AddService(typeof(AbpExceptionFilter));
64+
options.Filters.AddService(typeof(AbpResultFilter));
4965

5066
options.OutputFormatters.Add(new JsonOutputFormatter(
5167
new JsonSerializerSettings
@@ -55,14 +71,22 @@ public override IServiceProvider ConfigureServices(IServiceCollection services)
5571

5672
}).AddControllersAsServices();
5773

58-
5974
return base.ConfigureServices(services);
6075
}
6176

6277
public override void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
6378
{
6479
base.Configure(app, env, loggerFactory);
6580

81+
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
82+
loggerFactory.AddDebug();
83+
84+
if (env.IsDevelopment())
85+
{
86+
app.UseDeveloperExceptionPage();
87+
app.UseDatabaseErrorPage();
88+
}
89+
6690
app.UseStaticFiles();
6791

6892
app.UseMvc(routes =>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"ConnectionStrings": {
3+
"Default": "Server=localhost; Database=AbpProjectNameDb; Trusted_Connection=True;"
4+
},
5+
"Logging": {
6+
"IncludeScopes": false,
7+
"LogLevel": {
8+
"Default": "Debug",
9+
"System": "Information",
10+
"Microsoft": "Information"
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)