diff --git a/.github/renovate.json b/.github/renovate.json index 98411a821c0..595245c44b1 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -20,16 +20,6 @@ ], "groupName": "NUnit" }, - { - "matchPackageNames": [ - "Microsoft.AspNetCore", - "Microsoft.AspNetCore.Mvc", - "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation", - "Microsoft.AspNetCore.StaticFiles" - ], - "groupName": "Microsoft.AspNetCore 2.0", - "allowedVersions": "~2.1.0" - }, { "matchPackagePrefixes": [ "Oracle.ManagedDataAccess" diff --git a/src/NHibernate.Everything.sln b/src/NHibernate.Everything.sln index c2c257360fc..4d1b272a260 100644 --- a/src/NHibernate.Everything.sln +++ b/src/NHibernate.Everything.sln @@ -70,93 +70,54 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHibernate.Tool.HbmXsd", "N EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "NHibernate.Test.VisualBasic", "NHibernate.Test.VisualBasic\NHibernate.Test.VisualBasic.vbproj", "{7C2EF610-BCA0-4D1F-898A-DE9908E4970C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHibernate.Example.Web", "NHibernate.Example.Web\NHibernate.Example.Web.csproj", "{B291C1C1-599B-418E-8591-8A8CF1CAA188}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHibernate.TestDatabaseSetup", "NHibernate.TestDatabaseSetup\NHibernate.TestDatabaseSetup.csproj", "{783DB85E-2EED-4377-8EF4-8D6EFE042007}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|.NET = Debug|.NET Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms Release|.NET = Release|.NET Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {5909BFE7-93CF-4E5F-BE22-6293368AF01D}.Debug|.NET.ActiveCfg = Debug|Any CPU {5909BFE7-93CF-4E5F-BE22-6293368AF01D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5909BFE7-93CF-4E5F-BE22-6293368AF01D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5909BFE7-93CF-4E5F-BE22-6293368AF01D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {5909BFE7-93CF-4E5F-BE22-6293368AF01D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {5909BFE7-93CF-4E5F-BE22-6293368AF01D}.Release|.NET.ActiveCfg = Release|Any CPU {5909BFE7-93CF-4E5F-BE22-6293368AF01D}.Release|Any CPU.ActiveCfg = Release|Any CPU {5909BFE7-93CF-4E5F-BE22-6293368AF01D}.Release|Any CPU.Build.0 = Release|Any CPU - {5909BFE7-93CF-4E5F-BE22-6293368AF01D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {5909BFE7-93CF-4E5F-BE22-6293368AF01D}.Release|Mixed Platforms.Build.0 = Release|Any CPU {5C649B55-1B3F-4C38-9998-1B043E94A244}.Debug|.NET.ActiveCfg = Debug|Any CPU {5C649B55-1B3F-4C38-9998-1B043E94A244}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5C649B55-1B3F-4C38-9998-1B043E94A244}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5C649B55-1B3F-4C38-9998-1B043E94A244}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {5C649B55-1B3F-4C38-9998-1B043E94A244}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {5C649B55-1B3F-4C38-9998-1B043E94A244}.Release|.NET.ActiveCfg = Release|Any CPU {5C649B55-1B3F-4C38-9998-1B043E94A244}.Release|Any CPU.ActiveCfg = Release|Any CPU {5C649B55-1B3F-4C38-9998-1B043E94A244}.Release|Any CPU.Build.0 = Release|Any CPU - {5C649B55-1B3F-4C38-9998-1B043E94A244}.Release|Mixed Platforms.ActiveCfg = Debug|Any CPU - {5C649B55-1B3F-4C38-9998-1B043E94A244}.Release|Mixed Platforms.Build.0 = Debug|Any CPU {7AEE5B37-C552-4E59-9B6F-88755BCB5070}.Debug|.NET.ActiveCfg = Debug|Any CPU {7AEE5B37-C552-4E59-9B6F-88755BCB5070}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7AEE5B37-C552-4E59-9B6F-88755BCB5070}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7AEE5B37-C552-4E59-9B6F-88755BCB5070}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {7AEE5B37-C552-4E59-9B6F-88755BCB5070}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {7AEE5B37-C552-4E59-9B6F-88755BCB5070}.Release|.NET.ActiveCfg = Release|Any CPU {7AEE5B37-C552-4E59-9B6F-88755BCB5070}.Release|Any CPU.ActiveCfg = Release|Any CPU {7AEE5B37-C552-4E59-9B6F-88755BCB5070}.Release|Any CPU.Build.0 = Release|Any CPU - {7AEE5B37-C552-4E59-9B6F-88755BCB5070}.Release|Mixed Platforms.ActiveCfg = Debug|Any CPU - {7AEE5B37-C552-4E59-9B6F-88755BCB5070}.Release|Mixed Platforms.Build.0 = Debug|Any CPU {446E148D-A9D5-4D7D-A706-BEDD45B2BC7D}.Debug|.NET.ActiveCfg = Debug|Any CPU {446E148D-A9D5-4D7D-A706-BEDD45B2BC7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {446E148D-A9D5-4D7D-A706-BEDD45B2BC7D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {446E148D-A9D5-4D7D-A706-BEDD45B2BC7D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {446E148D-A9D5-4D7D-A706-BEDD45B2BC7D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {446E148D-A9D5-4D7D-A706-BEDD45B2BC7D}.Release|.NET.ActiveCfg = Release|Any CPU {446E148D-A9D5-4D7D-A706-BEDD45B2BC7D}.Release|Any CPU.ActiveCfg = Release|Any CPU {446E148D-A9D5-4D7D-A706-BEDD45B2BC7D}.Release|Any CPU.Build.0 = Release|Any CPU - {446E148D-A9D5-4D7D-A706-BEDD45B2BC7D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Debug|.NET.ActiveCfg = Debug|Any CPU {7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Release|.NET.ActiveCfg = Release|Any CPU {7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Release|Any CPU.ActiveCfg = Release|Any CPU {7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Release|Any CPU.Build.0 = Release|Any CPU - {7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {B291C1C1-599B-418E-8591-8A8CF1CAA188}.Debug|.NET.ActiveCfg = Debug|Any CPU - {B291C1C1-599B-418E-8591-8A8CF1CAA188}.Debug|.NET.Build.0 = Debug|Any CPU - {B291C1C1-599B-418E-8591-8A8CF1CAA188}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B291C1C1-599B-418E-8591-8A8CF1CAA188}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B291C1C1-599B-418E-8591-8A8CF1CAA188}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {B291C1C1-599B-418E-8591-8A8CF1CAA188}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {B291C1C1-599B-418E-8591-8A8CF1CAA188}.Release|.NET.ActiveCfg = Release|Any CPU - {B291C1C1-599B-418E-8591-8A8CF1CAA188}.Release|.NET.Build.0 = Release|Any CPU - {B291C1C1-599B-418E-8591-8A8CF1CAA188}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B291C1C1-599B-418E-8591-8A8CF1CAA188}.Release|Any CPU.Build.0 = Release|Any CPU - {B291C1C1-599B-418E-8591-8A8CF1CAA188}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {B291C1C1-599B-418E-8591-8A8CF1CAA188}.Release|Mixed Platforms.Build.0 = Release|Any CPU {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|.NET.ActiveCfg = Debug|Any CPU {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|.NET.Build.0 = Debug|Any CPU {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|Any CPU.Build.0 = Debug|Any CPU - {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|.NET.ActiveCfg = Release|Any CPU {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|.NET.Build.0 = Release|Any CPU {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|Any CPU.ActiveCfg = Release|Any CPU {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|Any CPU.Build.0 = Release|Any CPU - {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {783DB85E-2EED-4377-8EF4-8D6EFE042007}.Release|Mixed Platforms.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/NHibernate.Example.Web/Infrastructure/AppSessionFactory.cs b/src/NHibernate.Example.Web/Infrastructure/AppSessionFactory.cs deleted file mode 100644 index 38265648eda..00000000000 --- a/src/NHibernate.Example.Web/Infrastructure/AppSessionFactory.cs +++ /dev/null @@ -1,40 +0,0 @@ -using NHibernate.Cfg; -using NHibernate.Dialect; -using NHibernate.Driver; -using NHibernate.Example.Web.Models; -using NHibernate.Mapping.ByCode; - -namespace NHibernate.Example.Web.Infrastructure -{ - public class AppSessionFactory - { - public Configuration Configuration { get; } - public ISessionFactory SessionFactory { get; } - - public AppSessionFactory(Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) - { - NHibernate.NHibernateLogger.SetLoggersFactory(new NHibernateToMicrosoftLoggerFactory(loggerFactory)); - - var mapper = new ModelMapper(); - mapper.AddMapping(); - var domainMapping = mapper.CompileMappingForAllExplicitlyAddedEntities(); - - Configuration = new Configuration(); - Configuration.DataBaseIntegration(db => - { - db.ConnectionString = @"Server=(local)\SQLEXPRESS;initial catalog=nhibernate;Integrated Security=true"; - db.Dialect(); - db.Driver(); - }) - .AddMapping(domainMapping); - Configuration.SessionFactory().GenerateStatistics(); - - SessionFactory = Configuration.BuildSessionFactory(); - } - - public ISession OpenSession() - { - return SessionFactory.OpenSession(); - } - } -} diff --git a/src/NHibernate.Example.Web/Infrastructure/NHibernateToMicrosoftLogger.cs b/src/NHibernate.Example.Web/Infrastructure/NHibernateToMicrosoftLogger.cs deleted file mode 100644 index a30f2f1236f..00000000000 --- a/src/NHibernate.Example.Web/Infrastructure/NHibernateToMicrosoftLogger.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Internal; - -namespace NHibernate.Example.Web.Infrastructure -{ - public class NHibernateToMicrosoftLogger : INHibernateLogger - { - private readonly ILogger _msLogger; - - public NHibernateToMicrosoftLogger(ILogger msLogger) - { - _msLogger = msLogger ?? throw new ArgumentNullException(nameof(msLogger)); - } - - private static readonly Dictionary MapLevels = new Dictionary - { - { NHibernateLogLevel.Trace, LogLevel.Trace }, - { NHibernateLogLevel.Debug, LogLevel.Debug }, - { NHibernateLogLevel.Info, LogLevel.Information }, - { NHibernateLogLevel.Warn, LogLevel.Warning }, - { NHibernateLogLevel.Error, LogLevel.Error }, - { NHibernateLogLevel.Fatal, LogLevel.Critical }, - { NHibernateLogLevel.None, LogLevel.None }, - }; - - public void Log(NHibernateLogLevel logLevel, NHibernateLogValues state, Exception exception) - { - _msLogger.Log(MapLevels[logLevel], 0, new FormattedLogValues(state.Format, state.Args), exception, MessageFormatter); - } - - public bool IsEnabled(NHibernateLogLevel logLevel) - { - return _msLogger.IsEnabled(MapLevels[logLevel]); - } - - private static string MessageFormatter(object state, Exception error) - { - return state.ToString(); - } - } -} diff --git a/src/NHibernate.Example.Web/Infrastructure/NHibernateToMicrosoftLoggerFactory.cs b/src/NHibernate.Example.Web/Infrastructure/NHibernateToMicrosoftLoggerFactory.cs deleted file mode 100644 index 0e732127cd4..00000000000 --- a/src/NHibernate.Example.Web/Infrastructure/NHibernateToMicrosoftLoggerFactory.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; - -namespace NHibernate.Example.Web.Infrastructure -{ - public class NHibernateToMicrosoftLoggerFactory : INHibernateLoggerFactory - { - private readonly Microsoft.Extensions.Logging.ILoggerFactory _loggerFactory; - - public NHibernateToMicrosoftLoggerFactory(Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) - { - _loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory)); - } - - public INHibernateLogger LoggerFor(string keyName) - { - var msLogger = _loggerFactory.CreateLogger(keyName); - return new NHibernateToMicrosoftLogger(msLogger); - } - - public INHibernateLogger LoggerFor(System.Type type) - { - return LoggerFor( - Microsoft.Extensions.Logging.Abstractions.Internal.TypeNameHelper.GetTypeDisplayName(type)); - } - } -} diff --git a/src/NHibernate.Example.Web/Models/Item.cs b/src/NHibernate.Example.Web/Models/Item.cs deleted file mode 100644 index 7306ed585ca..00000000000 --- a/src/NHibernate.Example.Web/Models/Item.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace NHibernate.Example.Web.Models -{ - public class Item - { - public virtual int Id { get; set; } - public virtual decimal Price { get; set; } - public virtual string Description { get; set; } - } -} \ No newline at end of file diff --git a/src/NHibernate.Example.Web/Models/ItemMap.cs b/src/NHibernate.Example.Web/Models/ItemMap.cs deleted file mode 100644 index 6f206b8a5ef..00000000000 --- a/src/NHibernate.Example.Web/Models/ItemMap.cs +++ /dev/null @@ -1,16 +0,0 @@ -using NHibernate.Mapping.ByCode; -using NHibernate.Mapping.ByCode.Conformist; - -namespace NHibernate.Example.Web.Models -{ - public class ItemMap : ClassMapping - { - public ItemMap() - { - Lazy(false); - Id(x => x.Id, map => map.Generator(Generators.Native)); - Property(x => x.Price); - Property(x => x.Description); - } - } -} diff --git a/src/NHibernate.Example.Web/NHibernate.Example.Web.csproj b/src/NHibernate.Example.Web/NHibernate.Example.Web.csproj deleted file mode 100644 index 7bd7b9f7109..00000000000 --- a/src/NHibernate.Example.Web/NHibernate.Example.Web.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - netcoreapp2.0;net48 - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/NHibernate.Example.Web/Pages/Error.cshtml b/src/NHibernate.Example.Web/Pages/Error.cshtml deleted file mode 100644 index b1f3143a42e..00000000000 --- a/src/NHibernate.Example.Web/Pages/Error.cshtml +++ /dev/null @@ -1,23 +0,0 @@ -@page -@model ErrorModel -@{ - ViewData["Title"] = "Error"; -} - -

Error.

-

An error occurred while processing your request.

- -@if (Model.ShowRequestId) -{ -

- Request ID: @Model.RequestId -

-} - -

Development Mode

-

- Swapping to Development environment will display more detailed information about the error that occurred. -

-

- Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. -

diff --git a/src/NHibernate.Example.Web/Pages/Error.cshtml.cs b/src/NHibernate.Example.Web/Pages/Error.cshtml.cs deleted file mode 100644 index 8c9952f597a..00000000000 --- a/src/NHibernate.Example.Web/Pages/Error.cshtml.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc.RazorPages; - -namespace NHibernate.Example.Web.Pages -{ - public class ErrorModel : PageModel - { - public string RequestId { get; set; } - - public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); - - public void OnGet() - { - RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; - } - } -} diff --git a/src/NHibernate.Example.Web/Pages/Index.cshtml b/src/NHibernate.Example.Web/Pages/Index.cshtml deleted file mode 100644 index d76c879b19c..00000000000 --- a/src/NHibernate.Example.Web/Pages/Index.cshtml +++ /dev/null @@ -1,9 +0,0 @@ -@page -@model IndexModel -@{ - ViewData["Title"] = "NHibernate Demo"; -} - -

NHibernate Demo

-Schema Operations -View Data diff --git a/src/NHibernate.Example.Web/Pages/Index.cshtml.cs b/src/NHibernate.Example.Web/Pages/Index.cshtml.cs deleted file mode 100644 index 9d41b89fca1..00000000000 --- a/src/NHibernate.Example.Web/Pages/Index.cshtml.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; - -namespace NHibernate.Example.Web.Pages -{ - public class IndexModel : PageModel - { - public void OnGet() - { - } - } -} \ No newline at end of file diff --git a/src/NHibernate.Example.Web/Pages/InsertItem.cshtml b/src/NHibernate.Example.Web/Pages/InsertItem.cshtml deleted file mode 100644 index 1f2f61953be..00000000000 --- a/src/NHibernate.Example.Web/Pages/InsertItem.cshtml +++ /dev/null @@ -1,19 +0,0 @@ -@page -@model InsertItemModel -@{ - ViewData["Title"] = "Insert New Item"; -} -
- - - - - - - - - - - -
Price:
Description:
-
\ No newline at end of file diff --git a/src/NHibernate.Example.Web/Pages/InsertItem.cshtml.cs b/src/NHibernate.Example.Web/Pages/InsertItem.cshtml.cs deleted file mode 100644 index c670497996e..00000000000 --- a/src/NHibernate.Example.Web/Pages/InsertItem.cshtml.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; -using NHibernate.Example.Web.Models; - -namespace NHibernate.Example.Web.Pages -{ - public class InsertItemModel : PageModel - { - [BindProperty] - public InsertItemEvent NewItem { get; set; } - - private readonly ISession _session; - - public InsertItemModel(ISession session) - { - _session = session; - } - - public void OnGet() - { - } - - public IActionResult OnPost() - { - if (!ModelState.IsValid) - { - return Page(); - } - - using (var tx = _session.BeginTransaction()) - { - var item = new Item - { - Price = NewItem.Price, - Description = NewItem.Description, - }; - _session.Save(item); - - tx.Commit(); - } - - return RedirectToPage("/ViewData"); - } - - public IActionResult OnPostCancel() - { - return RedirectToPage("/ViewData"); - } - - public class InsertItemEvent - { - [Required, Range(0.0, double.MaxValue)] - public decimal Price { get; set; } - - public string Description { get; set; } - } - } -} \ No newline at end of file diff --git a/src/NHibernate.Example.Web/Pages/Schema.cshtml b/src/NHibernate.Example.Web/Pages/Schema.cshtml deleted file mode 100644 index ea9f23481b9..00000000000 --- a/src/NHibernate.Example.Web/Pages/Schema.cshtml +++ /dev/null @@ -1,16 +0,0 @@ -@page -@model SchemaModel -@{ - ViewData["Title"] = "Schema Operations"; -} - -Back to the main page - -
-
- - -
-
- -

@Model.Status

\ No newline at end of file diff --git a/src/NHibernate.Example.Web/Pages/Schema.cshtml.cs b/src/NHibernate.Example.Web/Pages/Schema.cshtml.cs deleted file mode 100644 index 42b2533fb0e..00000000000 --- a/src/NHibernate.Example.Web/Pages/Schema.cshtml.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; -using NHibernate.Example.Web.Infrastructure; -using NHibernate.Example.Web.Models; -using NHibernate.Tool.hbm2ddl; - -namespace NHibernate.Example.Web.Pages -{ - public class SchemaModel : PageModel - { - [TempData] - public string Status { get; set; } - - private readonly AppSessionFactory _applicationSession; - private readonly ISession _session; - - public SchemaModel(ISession session, AppSessionFactory applicationSession) - { - _applicationSession = applicationSession; - _session = session ?? throw new ArgumentNullException(nameof(session)); - } - - public void OnGet() - { - } - - public IActionResult OnPostCreateSchema() - { - var export = new SchemaExport(_applicationSession.Configuration); - export.Create(false, true); - - using (var tx = _session.BeginTransaction()) - { - var item1 = new Item - { - Description = "First item", - Price = 100m - }; - _session.Save(item1); - - var item2 = new Item - { - Description = "Second item", - Price = 150m - }; - _session.Save(item2); - - tx.Commit(); - } - - Status = "Schema created"; - return RedirectToPage(); - } - - public IActionResult OnPostDropSchema() - { - SchemaExport export = new SchemaExport(_applicationSession.Configuration); - export.Drop(false, true); - - Status = "Schema dropped"; - return RedirectToPage(); - } - } -} diff --git a/src/NHibernate.Example.Web/Pages/ViewData.cshtml b/src/NHibernate.Example.Web/Pages/ViewData.cshtml deleted file mode 100644 index ca4681624aa..00000000000 --- a/src/NHibernate.Example.Web/Pages/ViewData.cshtml +++ /dev/null @@ -1,40 +0,0 @@ -@page -@model ViewDataModel -@{ - ViewData["Title"] = "View Items"; -} - -
- - - - - - @foreach (var item in Model.Items) - { - - @if (Model.Editing == item.Id) - { - - - - - } - else - { - - - - - } - - } -
Item List
IdPriceDescription
- - - @item.Id - - - @item.Id@item.Price@item.Description
-
-Add New Item \ No newline at end of file diff --git a/src/NHibernate.Example.Web/Pages/ViewData.cshtml.cs b/src/NHibernate.Example.Web/Pages/ViewData.cshtml.cs deleted file mode 100644 index 6ac9785df97..00000000000 --- a/src/NHibernate.Example.Web/Pages/ViewData.cshtml.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; -using NHibernate.Example.Web.Models; - -namespace NHibernate.Example.Web.Pages -{ - public class ViewDataModel : PageModel - { - public IList Items { get; set; } - public int? Editing { get; set; } - - private readonly ISession _session; - - public ViewDataModel(ISession session) - { - _session = session; - } - - public void OnGet(int? editing) - { - Editing = editing; - - using (var tx = _session.BeginTransaction()) - { - Items = _session.QueryOver().List(); - } - } - - public IActionResult OnPostEdit(int id) - { - return RedirectToPage(new {editing = id}); - } - - public IActionResult OnPostDelete(int id) - { - using (var tx = _session.BeginTransaction()) - { - var item = _session.Get(id); - if (item != null) - { - _session.Delete(item); - } - - tx.Commit(); - } - - return RedirectToPage(); - } - - public IActionResult OnPostUpdate(int id, UpdateItemEvent updateItem) - { - if (!ModelState.IsValid) - { - return Page(); - } - - using (var tx = _session.BeginTransaction()) - { - var item = _session.Get(id); - if (item != null) - { - item.Price = updateItem.Price; - item.Description = updateItem.Description; - _session.Update(item); - } - - tx.Commit(); - } - - return RedirectToPage(); - } - - public IActionResult OnPostCancelUpdate() - { - return RedirectToPage(); - } - - public class UpdateItemEvent - { - [Required, Range(0.0, double.MaxValue)] - public decimal Price { get; set; } - public string Description { get; set; } - } - } -} diff --git a/src/NHibernate.Example.Web/Pages/_Layout.cshtml b/src/NHibernate.Example.Web/Pages/_Layout.cshtml deleted file mode 100644 index 7db516fb7d5..00000000000 --- a/src/NHibernate.Example.Web/Pages/_Layout.cshtml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - @ViewData["Title"] - - - - @RenderBody() - -

- @Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default.Application.RuntimeFramework -

- -@RenderSection("Scripts", required: false) - - diff --git a/src/NHibernate.Example.Web/Pages/_ViewImports.cshtml b/src/NHibernate.Example.Web/Pages/_ViewImports.cshtml deleted file mode 100644 index 935fef42347..00000000000 --- a/src/NHibernate.Example.Web/Pages/_ViewImports.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@using NHibernate.Example.Web -@namespace NHibernate.Example.Web.Pages -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/src/NHibernate.Example.Web/Pages/_ViewStart.cshtml b/src/NHibernate.Example.Web/Pages/_ViewStart.cshtml deleted file mode 100644 index a5f10045db9..00000000000 --- a/src/NHibernate.Example.Web/Pages/_ViewStart.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@{ - Layout = "_Layout"; -} diff --git a/src/NHibernate.Example.Web/Program.cs b/src/NHibernate.Example.Web/Program.cs deleted file mode 100644 index bf57dbb80fe..00000000000 --- a/src/NHibernate.Example.Web/Program.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; -using Serilog; -using Serilog.Events; - -namespace NHibernate.Example.Web -{ - public class Program - { - public static void Main(string[] args) - { - Log.Logger = new LoggerConfiguration() - .MinimumLevel.Debug() - .MinimumLevel.Override("Microsoft", LogEventLevel.Information) - .Enrich.FromLogContext() - .WriteTo.Console() - .CreateLogger(); - - BuildWebHost(args).Run(); - } - - public static IWebHost BuildWebHost(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseStartup() - .UseSerilog() - .Build(); - } -} diff --git a/src/NHibernate.Example.Web/Properties/launchSettings.json b/src/NHibernate.Example.Web/Properties/launchSettings.json deleted file mode 100644 index a39df606d36..00000000000 --- a/src/NHibernate.Example.Web/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:60203/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "NHibernate.Example.Web": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:60204/" - } - } -} diff --git a/src/NHibernate.Example.Web/Startup.cs b/src/NHibernate.Example.Web/Startup.cs deleted file mode 100644 index 8d21a5e684d..00000000000 --- a/src/NHibernate.Example.Web/Startup.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using NHibernate.Example.Web.Infrastructure; - -namespace NHibernate.Example.Web -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - services.AddSingleton(); - services.AddScoped(x => x.GetService().OpenSession()); - - services.AddMvc(); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - else - { - app.UseExceptionHandler("/Error"); - } - - app.UseStaticFiles(); - - app.UseMvc(routes => - { - routes.MapRoute( - name: "default", - template: "{controller}/{action=Index}/{id?}"); - }); - } - } -} diff --git a/src/NHibernate.Example.Web/appsettings.Development.json b/src/NHibernate.Example.Web/appsettings.Development.json deleted file mode 100644 index fa8ce71a97a..00000000000 --- a/src/NHibernate.Example.Web/appsettings.Development.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Logging": { - "IncludeScopes": false, - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - } - } -} diff --git a/src/NHibernate.Example.Web/appsettings.json b/src/NHibernate.Example.Web/appsettings.json deleted file mode 100644 index 5fff67bacc4..00000000000 --- a/src/NHibernate.Example.Web/appsettings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "IncludeScopes": false, - "LogLevel": { - "Default": "Warning" - } - } -}