From 37c6ff5a7f8ecd160c25142870520aef95479442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 25 Sep 2017 11:49:58 +0300 Subject: [PATCH] Added a simple sample console application. --- Volo.Abp.sln | 9 ++- test/SimpleConsoleDemo/Program.cs | 68 +++++++++++++++++++ .../SimpleConsoleDemo.csproj | 12 ++++ 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 test/SimpleConsoleDemo/Program.cs create mode 100644 test/SimpleConsoleDemo/SimpleConsoleDemo.csproj diff --git a/Volo.Abp.sln b/Volo.Abp.sln index 42fddd577f..0f4cb065d2 100644 --- a/Volo.Abp.sln +++ b/Volo.Abp.sln @@ -136,7 +136,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Identity.Applicati EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Identity.Domain", "src\Volo.Abp.Identity.Domain\Volo.Abp.Identity.Domain.csproj", "{43D4005C-4F04-4128-937B-52BEAC5A113B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Identity.Domain.Shared", "src\Volo.Abp.Identity.Domain.Shared\Volo.Abp.Identity.Domain.Shared.csproj", "{DF676F73-3FC9-46CE-909A-2D75E19982AD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Identity.Domain.Shared", "src\Volo.Abp.Identity.Domain.Shared\Volo.Abp.Identity.Domain.Shared.csproj", "{DF676F73-3FC9-46CE-909A-2D75E19982AD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleConsoleDemo", "test\SimpleConsoleDemo\SimpleConsoleDemo.csproj", "{2B48CF90-DBDB-469F-941C-5B5AECEEACE0}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -348,6 +350,10 @@ Global {DF676F73-3FC9-46CE-909A-2D75E19982AD}.Debug|Any CPU.Build.0 = Debug|Any CPU {DF676F73-3FC9-46CE-909A-2D75E19982AD}.Release|Any CPU.ActiveCfg = Release|Any CPU {DF676F73-3FC9-46CE-909A-2D75E19982AD}.Release|Any CPU.Build.0 = Release|Any CPU + {2B48CF90-DBDB-469F-941C-5B5AECEEACE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2B48CF90-DBDB-469F-941C-5B5AECEEACE0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2B48CF90-DBDB-469F-941C-5B5AECEEACE0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2B48CF90-DBDB-469F-941C-5B5AECEEACE0}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -413,6 +419,7 @@ Global {40E21A35-1C66-4E89-A16E-0475011F7EFD} = {146F561E-C7B8-4166-9383-47E1BC1A2E62} {43D4005C-4F04-4128-937B-52BEAC5A113B} = {1895A5C9-50D4-4568-9A3A-14657E615A5E} {DF676F73-3FC9-46CE-909A-2D75E19982AD} = {1895A5C9-50D4-4568-9A3A-14657E615A5E} + {2B48CF90-DBDB-469F-941C-5B5AECEEACE0} = {37087D1B-3693-4E96-983D-A69F210BDE53} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5} diff --git a/test/SimpleConsoleDemo/Program.cs b/test/SimpleConsoleDemo/Program.cs new file mode 100644 index 0000000000..8193538354 --- /dev/null +++ b/test/SimpleConsoleDemo/Program.cs @@ -0,0 +1,68 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Modularity; + +namespace SimpleConsoleDemo +{ + class Program + { + static void Main(string[] args) + { + using (var application = AbpApplicationFactory.Create(options => + { + + })) + { + application.Initialize(); + + Console.WriteLine("ABP initialized... Press ENTER to exit!"); + + var writers = application.ServiceProvider.GetServices(); + foreach (var writer in writers) + { + writer.Write(); + } + + Console.ReadLine(); + } + } + } + + public class MyConsoleModule : AbpModule + { + public override void ConfigureServices(IServiceCollection services) + { + services.AddAssemblyOf(); + } + } + + public interface IMessageWriter + { + void Write(); + } + + public class ConsoleMessageWriter : IMessageWriter, ITransientDependency + { + private readonly MessageSource _messageSource; + + public ConsoleMessageWriter(MessageSource messageSource) + { + _messageSource = messageSource; + } + + public void Write() + { + Console.WriteLine(_messageSource.GetMessage()); + } + } + + public class MessageSource : ITransientDependency + { + public string GetMessage() + { + return "Hello ABP!"; + } + } +} \ No newline at end of file diff --git a/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj b/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj new file mode 100644 index 0000000000..d2cd131578 --- /dev/null +++ b/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj @@ -0,0 +1,12 @@ + + + + Exe + netcoreapp2.0 + + + + + + +