wip!
This commit is contained in:
84
C:\Users\gfrancischini\Downloads\Logs\Log.txt
Normal file
84
C:\Users\gfrancischini\Downloads\Logs\Log.txt
Normal file
@ -0,0 +1,84 @@
|
||||
TpTrace Verbose: 0 : 6241, 1, 2018/04/26, 04:27:59.632, 1193259727529527, vstest.console.dll, TestPluginCache: Discovering the extensions using extension path.
|
||||
TpTrace Information: 0 : 6241, 1, 2018/04/26, 04:28:00.292, 1193259779056216, vstest.console.dll, AssemblyResolver: Microsoft.TestPlatform.Extensions.EventLogCollector: Resolving assembly.
|
||||
TpTrace Information: 0 : 6241, 1, 2018/04/26, 04:28:00.372, 1193259859230056, vstest.console.dll, AssemblyResolver: Microsoft.TestPlatform.Extensions.EventLogCollector: Resolved assembly.
|
||||
TpTrace Information: 0 : 6241, 1, 2018/04/26, 04:28:00.444, 1193259931655232, vstest.console.dll, AssemblyResolver: Microsoft.TestPlatform.TestHostRuntimeProvider: Resolving assembly.
|
||||
TpTrace Information: 0 : 6241, 1, 2018/04/26, 04:28:00.479, 1193259966114567, vstest.console.dll, AssemblyResolver: Microsoft.TestPlatform.TestHostRuntimeProvider: Resolved assembly.
|
||||
TpTrace Information: 0 : 6241, 1, 2018/04/26, 04:28:00.480, 1193259967773426, vstest.console.dll, AssemblyResolver: Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger: Resolving assembly.
|
||||
TpTrace Information: 0 : 6241, 1, 2018/04/26, 04:28:00.541, 1193260028136091, vstest.console.dll, AssemblyResolver: Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger: Resolved assembly.
|
||||
TpTrace Information: 0 : 6241, 1, 2018/04/26, 04:28:00.542, 1193260029510064, vstest.console.dll, AssemblyResolver: Microsoft.TestPlatform.Extensions.BlameDataCollector: Resolving assembly.
|
||||
TpTrace Information: 0 : 6241, 1, 2018/04/26, 04:28:00.567, 1193260054106633, vstest.console.dll, AssemblyResolver: Microsoft.TestPlatform.Extensions.BlameDataCollector: Resolved assembly.
|
||||
TpTrace Verbose: 0 : 6241, 1, 2018/04/26, 04:28:00.569, 1193260055941774, vstest.console.dll, TestPluginCache: Discovered the extensions using extension path ''.
|
||||
TpTrace Verbose: 0 : 6241, 1, 2018/04/26, 04:28:00.569, 1193260056176995, vstest.console.dll, TestPluginCache: Discoverers are ''.
|
||||
TpTrace Verbose: 0 : 6241, 1, 2018/04/26, 04:28:00.569, 1193260056345870, vstest.console.dll, TestPluginCache: Executors are ''.
|
||||
TpTrace Verbose: 0 : 6241, 1, 2018/04/26, 04:28:00.569, 1193260056469965, vstest.console.dll, TestPluginCache: Setting providers are ''.
|
||||
TpTrace Verbose: 0 : 6241, 1, 2018/04/26, 04:28:00.569, 1193260056587265, vstest.console.dll, TestPluginCache: Loggers are ''.
|
||||
TpTrace Information: 0 : 6241, 1, 2018/04/26, 04:28:00.758, 1193260245180811, vstest.console.dll, Trying to connect to server on port : 45057
|
||||
TpTrace Information: 0 : 6241, 1, 2018/04/26, 04:28:00.794, 1193260281084762, vstest.console.dll, Trying to connect to server on socket : 127.0.0.1:45057
|
||||
TpTrace Information: 0 : 6241, 4, 2018/04/26, 04:28:00.900, 1193260387053122, vstest.console.dll, Connected to the server successfully
|
||||
TpTrace Information: 0 : 6241, 4, 2018/04/26, 04:28:00.900, 1193260387338261, vstest.console.dll, Using the buffer size of 16384 bytes
|
||||
TpTrace Information: 0 : 6241, 1, 2018/04/26, 04:28:01.207, 1193260694493237, vstest.console.dll, DesignModeClient: Processing Message of message type: Extensions.Initialize
|
||||
TpTrace Information: 0 : 6241, 1, 2018/04/26, 04:28:01.213, 1193260700485049, vstest.console.dll, TestRequestManager.InitializeExtensions: Initialize extensions started.
|
||||
TpTrace Verbose: 0 : 6241, 1, 2018/04/26, 04:28:01.215, 1193260702015399, vstest.console.dll, TestPluginCache: Update extensions started. Skip filter = True
|
||||
TpTrace Information: 0 : 6241, 1, 2018/04/26, 04:28:01.215, 1193260702415428, vstest.console.dll, TestRequestManager.InitializeExtensions: Initialize extensions completed.
|
||||
TpTrace Information: 0 : 6241, 1, 2018/04/26, 04:28:01.216, 1193260702917059, vstest.console.dll, DesignModeClient: Processing Message of message type: ProtocolVersion
|
||||
TpTrace Information: 0 : 6241, 1, 2018/04/26, 04:28:06.202, 1193265689915767, vstest.console.dll, DesignModeClient: Processing Message of message type: TestDiscovery.Start
|
||||
TpTrace Information: 0 : 6241, 4, 2018/04/26, 04:28:06.205, 1193265692342686, vstest.console.dll, TestRequestManager.DiscoverTests: Discovery tests started.
|
||||
TpTrace Warning: 0 : 6241, 4, 2018/04/26, 04:28:06.509, 1193265996807362, vstest.console.dll, GetFrameWorkFromMetadata: failed to determine TargetFrameworkVersion: System.IO.DirectoryNotFoundException: Could not find a part of the path '/home/paul/workspace/yavsc/bin/Debug/netcoreapp1.0/UnitTest.dll'.
|
||||
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
|
||||
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
|
||||
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
|
||||
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
|
||||
at System.IO.File.Open(String path, FileMode mode, FileAccess access)
|
||||
at Microsoft.VisualStudio.TestPlatform.CommandLine.Processors.Utilities.AssemblyMetadataProvider.GetFrameWork(String filePath) for assembly: /home/paul/workspace/yavsc/bin/Debug/netcoreapp1.0/UnitTest.dll
|
||||
TpTrace Information: 0 : 6241, 4, 2018/04/26, 04:28:06.512, 1193265999616136, vstest.console.dll, Determined framework:'.NETCoreApp,Version=v1.0' for source: '/home/paul/workspace/yavsc/bin/Debug/netcoreapp1.0/UnitTest.dll'
|
||||
TpTrace Information: 0 : 6241, 4, 2018/04/26, 04:28:06.513, 1193266000536019, vstest.console.dll, Determined framework: .NETCoreApp,Version=v1.0
|
||||
TpTrace Information: 0 : 6241, 4, 2018/04/26, 04:28:06.611, 1193266097990100, vstest.console.dll, GetArchitectureForSource: Returning default:AnyCPU. Unhandled exception: Could not find a part of the path '/home/paul/workspace/yavsc/bin/Debug/netcoreapp1.0/UnitTest.dll'..
|
||||
TpTrace Information: 0 : 6241, 4, 2018/04/26, 04:28:06.611, 1193266098226561, vstest.console.dll, GetArchitecture: determined architecture:AnyCPU info for assembly: /home/paul/workspace/yavsc/bin/Debug/netcoreapp1.0/UnitTest.dll
|
||||
TpTrace Information: 0 : 6241, 4, 2018/04/26, 04:28:06.621, 1193266108220960, vstest.console.dll, Compatible sources list :
|
||||
TpTrace Information: 0 : 6241, 4, 2018/04/26, 04:28:06.621, 1193266108369894, vstest.console.dll, /home/paul/workspace/yavsc/bin/Debug/netcoreapp1.0/UnitTest.dll
|
||||
TpTrace Information: 0 : 6241, 4, 2018/04/26, 04:28:06.622, 1193266109808060, vstest.console.dll, TestPluginManager.CreateTestExtension: Attempting to load test extension: Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DefaultTestHostManager
|
||||
TpTrace Information: 0 : 6241, 4, 2018/04/26, 04:28:06.623, 1193266110064292, vstest.console.dll, TestPluginManager.CreateTestExtension: Attempting to load test extension: Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager
|
||||
TpTrace Verbose: 0 : 6241, 4, 2018/04/26, 04:28:06.623, 1193266110594003, vstest.console.dll, TestEngine: Initializing Parallel Execution as MaxCpuCount is set to: 1
|
||||
TpTrace Information: 0 : 6241, 4, 2018/04/26, 04:28:06.624, 1193266110939180, vstest.console.dll, InferRunSettingsHelper.IsTestSettingsEnabled: Unable to navigate to RunSettings/MSTest. Current node: RunSettings
|
||||
TpTrace Verbose: 0 : 6241, 4, 2018/04/26, 04:28:06.635, 1193266122354938, vstest.console.dll, DiscoveryRequest.DiscoverAsync: Starting.
|
||||
TpTrace Verbose: 0 : 6241, 4, 2018/04/26, 04:28:06.635, 1193266122828207, vstest.console.dll, ParallelProxyDiscoveryManager: Start discovery. Total sources: 1
|
||||
TpTrace Verbose: 0 : 6241, 4, 2018/04/26, 04:28:06.636, 1193266123327548, vstest.console.dll, ProxyParallelDiscoveryManager: Triggering test discovery for next source: /home/paul/workspace/yavsc/bin/Debug/netcoreapp1.0/UnitTest.dll
|
||||
TpTrace Verbose: 0 : 6241, 4, 2018/04/26, 04:28:06.636, 1193266123521644, vstest.console.dll, ProxyParallelDiscoveryManager: No sources available for discovery.
|
||||
TpTrace Verbose: 0 : 6241, 5, 2018/04/26, 04:28:06.636, 1193266123536115, vstest.console.dll, ParallelProxyDiscoveryManager: Discovery started.
|
||||
TpTrace Information: 0 : 6241, 4, 2018/04/26, 04:28:06.636, 1193266123635255, vstest.console.dll, DiscoveryRequest.DiscoverAsync: Started.
|
||||
TpTrace Verbose: 0 : 6241, 4, 2018/04/26, 04:28:06.636, 1193266123873307, vstest.console.dll, DiscoveryRequest.WaitForCompletion: Waiting with timeout -1.
|
||||
TpTrace Information: 0 : 6241, 5, 2018/04/26, 04:28:06.639, 1193266126033704, vstest.console.dll, Listening on Endpoint : 127.0.0.1:46507
|
||||
TpTrace Verbose: 0 : 6241, 5, 2018/04/26, 04:28:06.757, 1193266244226484, vstest.console.dll, DotnetTestHostmanager: Full path of dotnet.exe is /usr/share/dotnet/dotnet
|
||||
TpTrace Verbose: 0 : 6241, 5, 2018/04/26, 04:28:06.757, 1193266244521128, vstest.console.dll, DotnetTestHostmanager: File /home/paul/workspace/yavsc/bin/Debug/netcoreapp1.0/UnitTest.runtimeconfig.json, doesnot exist
|
||||
TpTrace Verbose: 0 : 6241, 5, 2018/04/26, 04:28:06.757, 1193266244607060, vstest.console.dll, DotnetTestHostmanager: File /home/paul/workspace/yavsc/bin/Debug/netcoreapp1.0/UnitTest.deps.json, doesnot exist
|
||||
TpTrace Information: 0 : 6241, 5, 2018/04/26, 04:28:06.757, 1193266244750221, vstest.console.dll, AssemblyResolver: Microsoft.Extensions.DependencyModel: Resolving assembly.
|
||||
TpTrace Information: 0 : 6241, 5, 2018/04/26, 04:28:06.758, 1193266245135491, vstest.console.dll, AssemblyResolver: Microsoft.Extensions.DependencyModel: Resolved assembly.
|
||||
TpTrace Verbose: 0 : 6241, 5, 2018/04/26, 04:28:06.758, 1193266245380381, vstest.console.dll, DotnetTestHostManager: Assume published test project, with test host path = /home/paul/workspace/yavsc/bin/Debug/netcoreapp1.0/testhost.dll.
|
||||
TpTrace Information: 0 : 6241, 5, 2018/04/26, 04:28:06.758, 1193266245629371, vstest.console.dll, AssemblyResolver: Microsoft.TestPlatform.TestHostRuntimeProvider.resources: Resolving assembly.
|
||||
TpTrace Information: 0 : 6241, 5, 2018/04/26, 04:28:06.759, 1193266246003219, vstest.console.dll, AssemblyResolver: Microsoft.TestPlatform.TestHostRuntimeProvider.resources: Resolving assembly.
|
||||
TpTrace Verbose: 0 : 6241, 5, 2018/04/26, 04:28:06.759, 1193266246244052, vstest.console.dll, DotnetTestHostmanager: No test is available in /home/paul/workspace/yavsc/bin/Debug/netcoreapp1.0/UnitTest.dll. Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk" and framework version settings are appropriate and try again.
|
||||
TpTrace Error: 0 : 6241, 5, 2018/04/26, 04:28:06.760, 1193266247037879, vstest.console.dll, ProxyDiscoveryManager.DiscoverTests: Failed to discover tests: System.IO.FileNotFoundException: No test is available in /home/paul/workspace/yavsc/bin/Debug/netcoreapp1.0/UnitTest.dll. Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk" and framework version settings are appropriate and try again.
|
||||
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostProcessStartInfo(IEnumerable`1 sources, IDictionary`2 environmentVariables, TestRunnerConnectionInfo connectionInfo)
|
||||
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, CancellationToken cancellationToken)
|
||||
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyDiscoveryManager.DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler2 eventHandler)
|
||||
TpTrace Verbose: 0 : 6241, 5, 2018/04/26, 04:28:06.772, 1193266259672338, vstest.console.dll, DiscoveryRequest.SendDiscoveryMessage: Starting.
|
||||
TpTrace Information: 0 : 6241, 5, 2018/04/26, 04:28:06.773, 1193266260088396, vstest.console.dll, DiscoveryRequest.SendDiscoveryMessage: Completed.
|
||||
TpTrace Verbose: 0 : 6241, 5, 2018/04/26, 04:28:06.778, 1193266265658559, vstest.console.dll, DiscoveryRequest.SendDiscoveredTests: Starting.
|
||||
TpTrace Information: 0 : 6241, 5, 2018/04/26, 04:28:06.778, 1193266265902021, vstest.console.dll, DiscoveryRequest.SendDiscoveredTests: Completed.
|
||||
TpTrace Verbose: 0 : 6241, 5, 2018/04/26, 04:28:06.779, 1193266266028414, vstest.console.dll, ParallelProxyDiscoveryManager: HandlePartialDiscoveryComplete: Total completed clients = 1, Discovery complete = True.
|
||||
TpTrace Verbose: 0 : 6241, 5, 2018/04/26, 04:28:06.839, 1193266326218521, vstest.console.dll, DiscoveryRequest.DiscoveryComplete: Starting. Aborted:True, TotalTests:-1
|
||||
TpTrace Verbose: 0 : 6241, 5, 2018/04/26, 04:28:06.843, 1193266330111913, vstest.console.dll, DiscoveryRequest.DiscoveryComplete: Notified the discovery complete event.
|
||||
TpTrace Verbose: 0 : 6241, 4, 2018/04/26, 04:28:06.843, 1193266330216985, vstest.console.dll, DiscoveryRequest.Dispose: Starting.
|
||||
TpTrace Information: 0 : 6241, 4, 2018/04/26, 04:28:06.843, 1193266330443150, vstest.console.dll, DiscoveryRequest.Dispose: Completed.
|
||||
TpTrace Information: 0 : 6241, 5, 2018/04/26, 04:28:06.843, 1193266330280918, vstest.console.dll, DiscoveryRequest.DiscoveryComplete: Completed.
|
||||
TpTrace Information: 0 : 6241, 4, 2018/04/26, 04:28:06.843, 1193266330567782, vstest.console.dll, TestRequestManager.DiscoverTests: Discovery tests completed, successful: True.
|
||||
TpTrace Information: 0 : 6241, 9, 2018/04/26, 04:48:37.469, 1194496956723882, vstest.console.dll, PortArgumentProcessor: parent process:6000 exited.
|
||||
TpTrace Information: 0 : 6241, 9, 2018/04/26, 04:48:37.476, 1194496963897798, vstest.console.dll, DesignModeClient: Parent process exited, Exiting myself..
|
||||
TpTrace Error: 0 : 6241, 1, 2018/04/26, 04:48:37.477, 1194496964065338, vstest.console.dll, DesignModeClient: Error processing request: System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
|
||||
at System.IO.__Error.EndOfFile()
|
||||
at System.IO.BinaryReader.ReadByte()
|
||||
at System.IO.BinaryReader.Read7BitEncodedInt()
|
||||
at System.IO.BinaryReader.ReadString()
|
||||
at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.SocketCommunicationManager.ReceiveMessage()
|
||||
at Microsoft.VisualStudio.TestPlatform.Client.DesignMode.DesignModeClient.ProcessRequests(ITestRequestManager testRequestManager)
|
||||
TpTrace Verbose: 0 : 6241, 1, 2018/04/26, 04:48:37.477, 1194496964311983, vstest.console.dll, Executor.Execute: Exiting with exit code of 0
|
6
Makefile
6
Makefile
@ -1,14 +1,14 @@
|
||||
|
||||
MAKE=make
|
||||
SUBDIRS=Yavsc.Abstract Yavsc.Server Yavsc
|
||||
VERSION=1.0.5-rc10
|
||||
SUBDIRS=Yavsc.Abstract Yavsc cli
|
||||
VERSION=1.0.5-rc11
|
||||
|
||||
all: $(SUBDIRS)
|
||||
|
||||
$(SUBDIRS):
|
||||
$(MAKE) -C $@ VERSION=$(VERSION)
|
||||
|
||||
deploy:
|
||||
deploy-pkgs:
|
||||
$(MAKE) -C Yavsc.Abstract deploy VERSION=$(VERSION)
|
||||
$(MAKE) -C Yavsc deploy-pkg VERSION=$(VERSION)
|
||||
|
||||
|
31
Yavsc.Abstract/Templates/Template.cs
Normal file
31
Yavsc.Abstract/Templates/Template.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yavsc.Abstract.Templates
|
||||
{
|
||||
/// <summary>
|
||||
/// A CSharp Razor template.
|
||||
/// </summary>
|
||||
public abstract class Template
|
||||
{
|
||||
|
||||
StringBuilder _buffer = new StringBuilder();
|
||||
|
||||
|
||||
public virtual void Write(object value)
|
||||
{ WriteLiteral(value); }
|
||||
|
||||
public virtual void WriteLiteral(object value)
|
||||
{ _buffer.Append(value); }
|
||||
|
||||
public string GeneratedText {
|
||||
get {
|
||||
return _buffer.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract Task ExecuteAsync();
|
||||
|
||||
}
|
||||
}
|
@ -30,6 +30,12 @@
|
||||
"Newtonsoft.Json": "9.0.1"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": {
|
||||
"frameworkAssemblies": {
|
||||
"System.ComponentModel.DataAnnotations": "4.0.0"
|
||||
|
||||
}
|
||||
},
|
||||
"net451": {
|
||||
"frameworkAssemblies": {
|
||||
"System.ComponentModel.DataAnnotations": "4.0.0"
|
||||
|
@ -2,6 +2,17 @@
|
||||
"locked": false,
|
||||
"version": 2,
|
||||
"targets": {
|
||||
"DNX,Version=v4.5.1": {
|
||||
"Newtonsoft.Json/9.0.1": {
|
||||
"type": "package",
|
||||
"compile": {
|
||||
"lib/net45/Newtonsoft.Json.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net45/Newtonsoft.Json.dll": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.5.1": {
|
||||
"Newtonsoft.Json/9.0.1": {
|
||||
"type": "package",
|
||||
@ -13,6 +24,28 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"DNX,Version=v4.5.1/debian.9-x86": {
|
||||
"Newtonsoft.Json/9.0.1": {
|
||||
"type": "package",
|
||||
"compile": {
|
||||
"lib/net45/Newtonsoft.Json.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net45/Newtonsoft.Json.dll": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"DNX,Version=v4.5.1/debian.9-x64": {
|
||||
"Newtonsoft.Json/9.0.1": {
|
||||
"type": "package",
|
||||
"compile": {
|
||||
"lib/net45/Newtonsoft.Json.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net45/Newtonsoft.Json.dll": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.5.1/debian.9-x86": {
|
||||
"Newtonsoft.Json/9.0.1": {
|
||||
"type": "package",
|
||||
@ -66,6 +99,9 @@
|
||||
"": [
|
||||
"Newtonsoft.Json >= 9.0.1"
|
||||
],
|
||||
"DNX,Version=v4.5.1": [
|
||||
"fx/System.ComponentModel.DataAnnotations >= 4.0.0"
|
||||
],
|
||||
".NETFramework,Version=v4.5.1": [
|
||||
"fx/System.ComponentModel.DataAnnotations >= 4.0.0"
|
||||
]
|
||||
|
@ -16,8 +16,6 @@ PACKAGE=$(DESTPATH)/$(PKGFILENAME)
|
||||
NUGETSOURCE=$(HOME)/Nupkgs/
|
||||
|
||||
all: $(BINTARGETPATH)
|
||||
|
||||
$(BINTARGETPATH):
|
||||
dnu build
|
||||
|
||||
deploy: clean pushInPre pushInProd
|
||||
@ -40,7 +38,7 @@ project.lock.json: project.json
|
||||
watch: project.lock.json
|
||||
ASPNET_ENV=$(ASPNET_ENV) ASPNET_LOG_LEVEL=$(ASPNET_LOG_LEVEL) dnx-watch web --configuration=$(CONFIGURATION)
|
||||
|
||||
run:
|
||||
run: project.lock.json
|
||||
ASPNET_ENV=$(ASPNET_ENV) dnx web --configuration=$(CONFIGURATION)
|
||||
|
||||
clean:
|
||||
|
17
Yavsc/Templates/UserOrientedTemplate.cs
Normal file
17
Yavsc/Templates/UserOrientedTemplate.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using Yavsc.Abstract.Templates;
|
||||
using Yavsc.Models;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yavsc.Templates
|
||||
{
|
||||
public class UserOrientedTemplate: Template
|
||||
{
|
||||
public ApplicationUser User { get; set; }
|
||||
|
||||
public override Task ExecuteAsync ()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -223,7 +223,7 @@
|
||||
if (element.formatted_address !== $('#' + config.addrId).val()) {
|
||||
$('<li>' + element.formatted_address + '</li>')
|
||||
.data("geoloc", element)
|
||||
.click(function () { chooseLoc('user', $(this).data("geoloc")) })
|
||||
.click(function () { chooseLoc('user') })
|
||||
.appendTo($('#' + config.locComboId));
|
||||
}
|
||||
else { }
|
||||
|
@ -1,180 +1,180 @@
|
||||
{
|
||||
"version": "1.0.1-*",
|
||||
"authors": [
|
||||
"Paul Schneider"
|
||||
],
|
||||
"packOptions": {
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pazof/yavsc"
|
||||
},
|
||||
"licenseUrl": "https://github.com/pazof/yavsc/blob/vnext/LICENSE",
|
||||
"requireLicenseAcceptance": true,
|
||||
"owners": [
|
||||
"Paul Schneider <paul@pschneider.fr>"
|
||||
"version": "1.0.5-rc11",
|
||||
"authors": [
|
||||
"Paul Schneider"
|
||||
],
|
||||
"summary": "Yet another very small company",
|
||||
"projectUrl": "http://yavsc.pschneider.fr",
|
||||
"tags": [
|
||||
"Blog",
|
||||
"PoS",
|
||||
"Chat"
|
||||
]
|
||||
},
|
||||
"userSecretsId": "aspnet5-YavscWeb-a0dadd21-2ced-43d3-96f9-7e504345102f",
|
||||
"buildOptions": {
|
||||
"debugType": "full",
|
||||
"emitEntryPoint": true,
|
||||
"outputName": "Yavsc",
|
||||
"compile": {
|
||||
"include": "*.cs",
|
||||
"exclude": [
|
||||
"wwwroot",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"contrib"
|
||||
]
|
||||
},
|
||||
"embed": [
|
||||
"Resources/**/*.resx"
|
||||
]
|
||||
},
|
||||
"configurations": {
|
||||
"Debug": {
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true,
|
||||
"define": [
|
||||
"DEBUG",
|
||||
"TRACE"
|
||||
"packOptions": {
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pazof/yavsc"
|
||||
},
|
||||
"licenseUrl": "https://github.com/pazof/yavsc/blob/vnext/LICENSE",
|
||||
"requireLicenseAcceptance": true,
|
||||
"owners": [
|
||||
"Paul Schneider <paul@pschneider.fr>"
|
||||
],
|
||||
"optimize": false,
|
||||
"summary": "Yet another very small company",
|
||||
"projectUrl": "http://yavsc.pschneider.fr",
|
||||
"tags": [
|
||||
"Blog",
|
||||
"PoS",
|
||||
"Chat"
|
||||
]
|
||||
},
|
||||
"userSecretsId": "aspnet5-YavscWeb-a0dadd21-2ced-43d3-96f9-7e504345102f",
|
||||
"buildOptions": {
|
||||
"debugType": "full",
|
||||
"platform": "anycpu"
|
||||
}
|
||||
"emitEntryPoint": true,
|
||||
"outputName": "Yavsc",
|
||||
"compile": {
|
||||
"include": "*.cs",
|
||||
"exclude": [
|
||||
"wwwroot",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"contrib"
|
||||
]
|
||||
},
|
||||
"embed": [
|
||||
"Resources/**/*.resx"
|
||||
]
|
||||
},
|
||||
"Release": {
|
||||
"compilationOptions": {
|
||||
"define": [
|
||||
"RELEASE",
|
||||
"TRACE"
|
||||
],
|
||||
"optimize": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"webroot": "wwwroot",
|
||||
"tooling": {
|
||||
"defaultNamespace": "Yavsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"EntityFramework.Commands": "7.0.0-rc1-final",
|
||||
"EntityFramework.Core": "7.0.0-rc1-final",
|
||||
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
|
||||
"EntityFramework.Relational": "7.0.0-rc1-final",
|
||||
"EntityFramework7.Npgsql": "3.1.0-rc1-3",
|
||||
"EntityFramework7.Npgsql.Design": "3.1.0-rc1-5",
|
||||
"MailKit": "1.12.0",
|
||||
"MarkdownDeep-av.NET": "1.5.6",
|
||||
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Authentication.Facebook": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Authorization": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Http.Abstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-*",
|
||||
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-*",
|
||||
"Microsoft.AspNet.Localization": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Mvc": "6.0.0-rc1-*",
|
||||
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-*",
|
||||
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.SignalR.Core": "2.2.1",
|
||||
"Microsoft.AspNet.SignalR.JS": "2.2.1",
|
||||
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-*",
|
||||
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-*",
|
||||
"Microsoft.AspNet.WebSockets.Server": "1.0.0-rc1-*",
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Logging.TraceSource": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Globalization.CultureInfoCache": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Localization": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Localization.Abstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
|
||||
"Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta8",
|
||||
"Microsoft.Framework.Configuration.Binder": "1.0.0-beta8",
|
||||
"Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
|
||||
"Microsoft.AspNet.Session": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Web.Optimization": "1.1.3",
|
||||
"Microsoft.Extensions.WebEncoders.Core": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Options": "0.0.1-alpha",
|
||||
"Microsoft.Extensions.WebEncoders": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.DataProtection": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.DataProtection.SystemWeb": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Authentication.OAuth": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Mvc.Formatters.Json": "6.0.0-rc1-final",
|
||||
"Microsoft.AspNet.OWin": "1.0.0-rc1-final",
|
||||
"System.Json": "4.0.20126.16343",
|
||||
"Yavsc.Abstract": {
|
||||
"target": "project",
|
||||
"type": "build"
|
||||
"configurations": {
|
||||
"Debug": {
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true,
|
||||
"define": [
|
||||
"DEBUG",
|
||||
"TRACE"
|
||||
],
|
||||
"optimize": false,
|
||||
"debugType": "full",
|
||||
"platform": "anycpu"
|
||||
}
|
||||
},
|
||||
"Release": {
|
||||
"compilationOptions": {
|
||||
"define": [
|
||||
"RELEASE",
|
||||
"TRACE"
|
||||
],
|
||||
"optimize": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"OAuth.AspNet.Token": {
|
||||
"target": "project",
|
||||
"type": "build"
|
||||
"webroot": "wwwroot",
|
||||
"tooling": {
|
||||
"defaultNamespace": "Yavsc"
|
||||
},
|
||||
"OAuth.AspNet.AuthServer": {
|
||||
"target": "project",
|
||||
"type": "build"
|
||||
"dependencies": {
|
||||
"EntityFramework.Commands": "7.0.0-rc1-final",
|
||||
"EntityFramework.Core": "7.0.0-rc1-final",
|
||||
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
|
||||
"EntityFramework.Relational": "7.0.0-rc1-final",
|
||||
"EntityFramework7.Npgsql": "3.1.0-rc1-3",
|
||||
"EntityFramework7.Npgsql.Design": "3.1.0-rc1-5",
|
||||
"MailKit": "1.12.0",
|
||||
"MarkdownDeep-av.NET": "1.5.6",
|
||||
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Authentication.Facebook": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Authorization": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Http.Abstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-*",
|
||||
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-*",
|
||||
"Microsoft.AspNet.Localization": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Mvc": "6.0.0-rc1-*",
|
||||
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-*",
|
||||
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.SignalR.Core": "2.2.1",
|
||||
"Microsoft.AspNet.SignalR.JS": "2.2.1",
|
||||
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-*",
|
||||
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-*",
|
||||
"Microsoft.AspNet.WebSockets.Server": "1.0.0-rc1-*",
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Logging.TraceSource": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Globalization.CultureInfoCache": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Localization": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Localization.Abstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
|
||||
"Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta8",
|
||||
"Microsoft.Framework.Configuration.Binder": "1.0.0-beta8",
|
||||
"Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
|
||||
"Microsoft.AspNet.Session": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Web.Optimization": "1.1.3",
|
||||
"Microsoft.Extensions.WebEncoders.Core": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Options": "0.0.1-alpha",
|
||||
"Microsoft.Extensions.WebEncoders": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.DataProtection": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.DataProtection.SystemWeb": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Authentication.OAuth": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Mvc.Formatters.Json": "6.0.0-rc1-final",
|
||||
"Microsoft.AspNet.OWin": "1.0.0-rc1-final",
|
||||
"System.Json": "4.0.20126.16343",
|
||||
"Yavsc.Abstract": {
|
||||
"target": "project",
|
||||
"type": "default"
|
||||
},
|
||||
"OAuth.AspNet.Token": {
|
||||
"target": "project",
|
||||
"type": "build"
|
||||
},
|
||||
"OAuth.AspNet.AuthServer": {
|
||||
"target": "project",
|
||||
"type": "build"
|
||||
},
|
||||
"Microsoft.AspNet.Http.Extensions": "1.0.0-rc1-final",
|
||||
"Microsoft.DiaSymReader.Native": "1.5.0",
|
||||
"PayPalMerchant-net451": "2.7.109",
|
||||
"Gapi.net45": "1.0.0",
|
||||
"Microsoft.AspNet.Authentication.JwtBearer": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.CodeGeneration": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.CodeGenerators.Mvc": {
|
||||
"type": "build",
|
||||
"version": "1.0.0-rc1-final"
|
||||
}
|
||||
},
|
||||
"Microsoft.AspNet.Http.Extensions": "1.0.0-rc1-final",
|
||||
"Microsoft.DiaSymReader.Native": "1.5.0",
|
||||
"PayPalMerchant-net451": "2.7.109",
|
||||
"Gapi.net45": "1.0.0",
|
||||
"Microsoft.AspNet.Authentication.JwtBearer": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.CodeGeneration": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.CodeGenerators.Mvc": {
|
||||
"type": "build",
|
||||
"version": "1.0.0-rc1-final"
|
||||
}
|
||||
},
|
||||
"commands": {
|
||||
"web": "Microsoft.AspNet.Server.Kestrel --server.urls http://*:5000",
|
||||
"coiffure": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:88",
|
||||
"lua": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:85",
|
||||
"luatest": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:5001",
|
||||
"kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:5000",
|
||||
"zicmoove": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:87",
|
||||
"yavsc": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:86",
|
||||
"yavscpre": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:84",
|
||||
"ef": "EntityFramework.Commands",
|
||||
"gen": "Microsoft.Extensions.CodeGeneration"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": {
|
||||
"frameworkAssemblies": {
|
||||
"System.Drawing": "4.0.0.0",
|
||||
"System.Net": "4.0.0.0",
|
||||
"System.Xml": "4.0.0.0",
|
||||
"System": "4.0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"publishOptions": {
|
||||
"exclude": [
|
||||
"**.user",
|
||||
"**.vspscc",
|
||||
"contrib/**/*.*"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "gulp min"
|
||||
},
|
||||
"embed": "Views/**/*.cshtml"
|
||||
"commands": {
|
||||
"web": "Microsoft.AspNet.Server.Kestrel --server.urls http://*:5000",
|
||||
"coiffure": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:88",
|
||||
"lua": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:85",
|
||||
"luatest": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:5001",
|
||||
"kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:5000",
|
||||
"zicmoove": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:87",
|
||||
"yavsc": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:86",
|
||||
"yavscpre": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:84",
|
||||
"ef": "EntityFramework.Commands",
|
||||
"gen": "Microsoft.Extensions.CodeGeneration"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": {
|
||||
"frameworkAssemblies": {
|
||||
"System.Drawing": "4.0.0.0",
|
||||
"System.Net": "4.0.0.0",
|
||||
"System.Xml": "4.0.0.0",
|
||||
"System": "4.0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"publishOptions": {
|
||||
"exclude": [
|
||||
"**.user",
|
||||
"**.vspscc",
|
||||
"contrib/**/*.*"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "gulp min"
|
||||
},
|
||||
"embed": "Views/**/*.cshtml"
|
||||
}
|
14
cli/Makefile
Normal file
14
cli/Makefile
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
all: build
|
||||
|
||||
build: project.lock.json
|
||||
dnu build
|
||||
|
||||
project.lock.json: project.json
|
||||
|
||||
bin/output/approot/run: project.lock.json
|
||||
dnu restore
|
||||
|
||||
run: bin/output/approot/run
|
||||
ASPNET_ENV=Development dnx run
|
@ -2,10 +2,6 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Yavsc;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Server.Helpers;
|
||||
using Yavsc.Services;
|
||||
using Microsoft.Extensions.OptionsModel;
|
||||
|
||||
using System.Globalization;
|
||||
@ -25,6 +21,11 @@ using Microsoft.AspNet.Razor;
|
||||
using Microsoft.Extensions.DependencyInjection.Abstractions;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
using cli.Services;
|
||||
using Yavsc;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Server.Helpers;
|
||||
using Yavsc.Services;
|
||||
using Yavsc.Templates;
|
||||
|
||||
namespace cli
|
||||
{
|
||||
@ -32,9 +33,11 @@ namespace cli
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
|
||||
var host = new WebHostBuilder();
|
||||
|
||||
var hostengnine = host.UseEnvironment("Develpment")
|
||||
var hostengnine = host
|
||||
.UseEnvironment("Development")
|
||||
.UseServer("cli")
|
||||
.UseStartup<Startup>()
|
||||
|
||||
@ -45,8 +48,8 @@ namespace cli
|
||||
.Build();
|
||||
|
||||
var app = hostengnine.Start();
|
||||
app.Services.GetService<EMailer>();
|
||||
|
||||
var mailer = app.Services.GetService<EMailer>();
|
||||
mailer.AllUserGen(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,12 +81,13 @@ namespace cli
|
||||
// Set up configuration sources.
|
||||
|
||||
var builder = new ConfigurationBuilder()
|
||||
.AddEnvironmentVariables()
|
||||
.AddJsonFile("appsettings.json")
|
||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
|
||||
builder.AddEnvironmentVariables();
|
||||
Configuration = builder.Build();
|
||||
|
||||
}
|
||||
|
||||
public void ConfigureServices (IServiceCollection services)
|
||||
{
|
||||
services.AddOptions();
|
||||
@ -116,7 +120,9 @@ namespace cli
|
||||
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||
loggerFactory.AddDebug();
|
||||
logger = loggerFactory.CreateLogger<Startup>();
|
||||
logger.LogInformation("Hello World from Configure ...");
|
||||
logger.LogInformation(env.EnvironmentName);
|
||||
var cxstr = Configuration["Data:DefaultConnection:ConnectionString"];
|
||||
DbHelpers.ConnectionString = cxstr;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,35 +1,165 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.CodeDom;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.Emit;
|
||||
|
||||
using Microsoft.AspNet.Razor;
|
||||
using Microsoft.AspNet.Razor.Generator;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.CSharp;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Identity;
|
||||
using System.Reflection;
|
||||
using Yavsc.Templates;
|
||||
using Yavsc.Abstract.Templates;
|
||||
using Microsoft.AspNet.Identity.EntityFramework;
|
||||
|
||||
namespace cli.Services
|
||||
{
|
||||
public class EMailer
|
||||
|
||||
public class EMailer
|
||||
{
|
||||
RazorTemplateEngine razorEngine;
|
||||
IStringLocalizer<EMailer> stringLocalizer;
|
||||
ILogger logger;
|
||||
ApplicationDbContext dbContext;
|
||||
|
||||
const string DefaultClassName = "ATemplate";
|
||||
const string DefaultBaseClass = nameof(UserOrientedTemplate);
|
||||
const string DefaultNamespace = "CompiledRazorTemplates";
|
||||
|
||||
RazorEngineHost host;
|
||||
public EMailer(ApplicationDbContext context, IStringLocalizer<EMailer> localizer, ILoggerFactory loggerFactory)
|
||||
{
|
||||
RazorTemplateEngine razorEngine;
|
||||
IStringLocalizer<EMailer> stringLocalizer;
|
||||
ILogger logger;
|
||||
ApplicationDbContext dbContext;
|
||||
stringLocalizer = localizer;
|
||||
|
||||
logger = loggerFactory.CreateLogger<EMailer>();
|
||||
|
||||
var language = new CSharpRazorCodeLanguage();
|
||||
|
||||
host = new RazorEngineHost(language) {
|
||||
DefaultBaseClass = DefaultBaseClass,
|
||||
DefaultClassName = DefaultClassName,
|
||||
DefaultNamespace = DefaultNamespace
|
||||
};
|
||||
|
||||
|
||||
public EMailer(ApplicationDbContext context, RazorTemplateEngine razorTemplateEngine, IStringLocalizer<EMailer> localizer, ILoggerFactory loggerFactory)
|
||||
{
|
||||
logger = loggerFactory.CreateLogger<EMailer>();
|
||||
// Everyone needs the System namespace, right?
|
||||
host.NamespaceImports.Add("System");
|
||||
host.NamespaceImports.Add("Yavsc.Templates");
|
||||
host.NamespaceImports.Add("Yavsc.Models");
|
||||
host.NamespaceImports.Add("Yavsc.Models.Identity");
|
||||
host.NamespaceImports.Add("Microsoft.AspNet.Identity.EntityFramework");
|
||||
host.InstrumentedSourceFilePath = "bin/output/approot/src/";
|
||||
host.StaticHelpers=true;
|
||||
dbContext = context;
|
||||
|
||||
razorEngine = razorTemplateEngine;
|
||||
this.razorEngine = new RazorTemplateEngine(host);
|
||||
|
||||
stringLocalizer = localizer;
|
||||
|
||||
dbContext = context;
|
||||
}
|
||||
|
||||
public string Gen(long templateCode)
|
||||
{
|
||||
string subtemp = stringLocalizer["MonthlySubjectTemplate"].Value;
|
||||
logger.LogInformation ( $"Using code: {templateCode} and subject: {subtemp} " );
|
||||
throw new NotImplementedException("razorEngine.GenerateCode");
|
||||
}
|
||||
}
|
||||
public void AllUserGen(long templateCode)
|
||||
{
|
||||
string className = DefaultClassName;
|
||||
string subtemp = stringLocalizer["MonthlySubjectTemplate"].Value;
|
||||
|
||||
logger.LogInformation($"Generating {subtemp}[{className}]");
|
||||
var templateInfo = dbContext.MailingTemplate.FirstOrDefault (t => t.Id == templateCode);
|
||||
|
||||
logger.LogInformation ( $"Using code: {templateCode} and subject: {subtemp} " );
|
||||
|
||||
logger.LogInformation (templateInfo.Body);
|
||||
|
||||
using (StringReader reader = new StringReader(templateInfo.Body)) {
|
||||
|
||||
// Generate code for the template
|
||||
var razorResult =
|
||||
razorEngine.GenerateCode(reader,className,DefaultNamespace,"fakeFileName.cs");
|
||||
|
||||
logger.LogInformation("Razor exited "+(razorResult.Success?"Ok":"Ko")+".");
|
||||
logger.LogInformation(razorResult.GeneratedCode);
|
||||
|
||||
SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText(razorResult.GeneratedCode);
|
||||
|
||||
|
||||
string assemblyName = Path.GetRandomFileName();
|
||||
MetadataReference[] references = new MetadataReference[]
|
||||
{
|
||||
MetadataReference.CreateFromFile(typeof(object).Assembly.Location),
|
||||
MetadataReference.CreateFromFile(typeof(Enumerable).Assembly.Location),
|
||||
MetadataReference.CreateFromFile(typeof(IdentityUser).Assembly.Location),
|
||||
MetadataReference.CreateFromFile("bin/Debug/dnx451/cli.dll") ,
|
||||
MetadataReference.CreateFromFile( "../Yavsc/bin/Debug/dnx451/Yavsc.dll" ),
|
||||
MetadataReference.CreateFromFile( "../Yavsc.Abstract/bin/Debug/dnx451/Yavsc.Abstract.dll" )
|
||||
};
|
||||
//Microsoft.CodeAnalysis.SourceReferenceResolver resolver = new CliSourceReferenceResolver() ;
|
||||
|
||||
|
||||
var compilationOptions = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)
|
||||
// .WithModuleName("Yavsc.Absctract").WithModuleName("Yavsc")
|
||||
.WithAllowUnsafe(true).WithOptimizationLevel(OptimizationLevel.Release)
|
||||
.WithOutputKind(OutputKind.DynamicallyLinkedLibrary).WithPlatform(Platform.AnyCpu);
|
||||
|
||||
CSharpCompilation compilation = CSharpCompilation.Create(
|
||||
assemblyName,
|
||||
syntaxTrees: new[] { syntaxTree },
|
||||
references: references,
|
||||
options: compilationOptions);
|
||||
|
||||
|
||||
foreach (var mref in references) logger.LogInformation($"ctor used ref to {mref.Display}[{mref.Properties.Kind}]");
|
||||
|
||||
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
EmitResult result = compilation.Emit(ms);
|
||||
|
||||
if (!result.Success)
|
||||
{
|
||||
IEnumerable<Diagnostic> failures = result.Diagnostics.Where(diagnostic =>
|
||||
diagnostic.IsWarningAsError ||
|
||||
diagnostic.Severity == DiagnosticSeverity.Error);
|
||||
|
||||
foreach (Diagnostic diagnostic in failures)
|
||||
{
|
||||
logger.LogCritical("{0}: {1}", diagnostic.Id, diagnostic.GetMessage());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
Assembly assembly = Assembly.Load(ms.ToArray());
|
||||
|
||||
Type type = assembly.GetType(className);
|
||||
var generatedtemplate = (UserOrientedTemplate) Activator.CreateInstance(type);
|
||||
logger.LogInformation(generatedtemplate.ToString());
|
||||
foreach (var user in dbContext.ApplicationUser) {
|
||||
logger.LogInformation(user.ToString());
|
||||
|
||||
generatedtemplate.User = user;
|
||||
generatedtemplate.ExecuteAsync();
|
||||
logger.LogInformation (generatedtemplate.GeneratedText);
|
||||
}
|
||||
|
||||
/* ... type.InvokeMember("Write",
|
||||
BindingFlags.Default | BindingFlags.InvokeMethod,
|
||||
null,
|
||||
model,
|
||||
new object[] { "Hello World" }); */
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,15 +19,29 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Hosting": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.DependencyInjection": "1.0.0-rc1-final",
|
||||
"Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
|
||||
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
|
||||
"Microsoft.Extensions.Configuration.Abstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Logging.TraceSource": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Globalization.CultureInfoCache": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Localization": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Localization.Abstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.WebEncoders.Core": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Options": "0.0.1-alpha",
|
||||
"Microsoft.Extensions.WebEncoders": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.CodeGeneration": "1.0.0-rc1-final",
|
||||
"Microsoft.AspNet.Mvc": "6.0.0-rc1-*",
|
||||
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.Framework.Configuration.Json": "1.0.0-*",
|
||||
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*",
|
||||
"Yavsc": { "type": "build", "target": "project" },
|
||||
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-*",
|
||||
"Microsoft.AspNet.Identity": "3.0.0-rc1-*",
|
||||
"Yavsc": "1.0.5-rc11",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-rc1-final",
|
||||
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final"
|
||||
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
|
||||
"Microsoft.CodeAnalysis": "1.0.0-rc1"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": {}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,8 +8,9 @@
|
||||
"OAuth.AspNet.Server"
|
||||
],
|
||||
"sdk": {
|
||||
"version": "1.0.0-rc1-update2",
|
||||
"version": "2.1.4",
|
||||
"runtime": "mono",
|
||||
"architecture": "x64"
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user