diff --git a/cloudscribe.Logging.sln b/cloudscribe.Logging.sln index 956fbc5..1f2c616 100644 --- a/cloudscribe.Logging.sln +++ b/cloudscribe.Logging.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29209.152 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35521.163 d17.12 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{46FB9706-B599-4853-95FD-58E2D553C5F7}" EndProject @@ -17,8 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "cloudscribe.Logging.EFCore. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "cloudscribe.Logging.EFCore.MySql", "src\cloudscribe.Logging.EFCore.MySql\cloudscribe.Logging.EFCore.MySql.csproj", "{BEAF528E-90EA-43B8-9E61-6340B8395EF8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "cloudscribe.Logging.EFCore.pgsql", "src\cloudscribe.Logging.EFCore.pgsql\cloudscribe.Logging.EFCore.pgsql.csproj", "{3EFC6E9A-3C47-4B77-B2CE-2DBAFEDCC897}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "cloudscribe.Logging.EFCore.SQLite", "src\cloudscribe.Logging.EFCore.SQLite\cloudscribe.Logging.EFCore.SQLite.csproj", "{E30B3FF2-DF66-43D0-A445-28F02EBB5C34}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "cloudscribe.Logging", "src\cloudscribe.Logging\cloudscribe.Logging.csproj", "{1E64CA28-006E-4AD8-BAB4-FB8096C6AC4D}" @@ -55,10 +53,6 @@ Global {BEAF528E-90EA-43B8-9E61-6340B8395EF8}.Debug|Any CPU.Build.0 = Debug|Any CPU {BEAF528E-90EA-43B8-9E61-6340B8395EF8}.Release|Any CPU.ActiveCfg = Release|Any CPU {BEAF528E-90EA-43B8-9E61-6340B8395EF8}.Release|Any CPU.Build.0 = Release|Any CPU - {3EFC6E9A-3C47-4B77-B2CE-2DBAFEDCC897}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3EFC6E9A-3C47-4B77-B2CE-2DBAFEDCC897}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3EFC6E9A-3C47-4B77-B2CE-2DBAFEDCC897}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3EFC6E9A-3C47-4B77-B2CE-2DBAFEDCC897}.Release|Any CPU.Build.0 = Release|Any CPU {E30B3FF2-DF66-43D0-A445-28F02EBB5C34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E30B3FF2-DF66-43D0-A445-28F02EBB5C34}.Debug|Any CPU.Build.0 = Debug|Any CPU {E30B3FF2-DF66-43D0-A445-28F02EBB5C34}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -89,7 +83,6 @@ Global {0D17DD9B-D820-4CCE-9C83-784E69AADED0} = {46FB9706-B599-4853-95FD-58E2D553C5F7} {8DA73C1A-8E7E-4832-B476-1503C6080490} = {46FB9706-B599-4853-95FD-58E2D553C5F7} {BEAF528E-90EA-43B8-9E61-6340B8395EF8} = {46FB9706-B599-4853-95FD-58E2D553C5F7} - {3EFC6E9A-3C47-4B77-B2CE-2DBAFEDCC897} = {46FB9706-B599-4853-95FD-58E2D553C5F7} {E30B3FF2-DF66-43D0-A445-28F02EBB5C34} = {46FB9706-B599-4853-95FD-58E2D553C5F7} {1E64CA28-006E-4AD8-BAB4-FB8096C6AC4D} = {46FB9706-B599-4853-95FD-58E2D553C5F7} {529323E2-AA3A-4350-BDE3-4AC80555FD9A} = {46FB9706-B599-4853-95FD-58E2D553C5F7} diff --git a/src/Demo.WebApp/Demo.WebApp.csproj b/src/Demo.WebApp/Demo.WebApp.csproj index e6732ab..56b2310 100644 --- a/src/Demo.WebApp/Demo.WebApp.csproj +++ b/src/Demo.WebApp/Demo.WebApp.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -39,7 +39,6 @@ - diff --git a/src/WebAppMvc/WebAppMvc.csproj b/src/WebAppMvc/WebAppMvc.csproj index 2a9dee7..7dc8702 100644 --- a/src/WebAppMvc/WebAppMvc.csproj +++ b/src/WebAppMvc/WebAppMvc.csproj @@ -9,7 +9,6 @@ - diff --git a/src/cloudscribe.Logging.EFCore.pgsql/LoggingDbContext.cs b/src/cloudscribe.Logging.EFCore.pgsql/LoggingDbContext.cs deleted file mode 100644 index 0274573..0000000 --- a/src/cloudscribe.Logging.EFCore.pgsql/LoggingDbContext.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Source Tree Solutions, LLC. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -// Author: Joe Audette -// Created: 2016-11-10 -// Last Modified: 2016-11-10 -// - -using cloudscribe.Logging.Models; -using Microsoft.EntityFrameworkCore; - -namespace cloudscribe.Logging.EFCore.pgsql -{ - public class LoggingDbContext : LoggingDbContextBase, ILoggingDbContext - { - - public LoggingDbContext( - DbContextOptions options) : base(options) - { - // we don't want to track any logitems because we dont edit them - // we add them delete them and view them - //ChangeTracker.AutoDetectChangesEnabled = false; - ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; - - } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - base.OnModelCreating(modelBuilder); - - modelBuilder.HasSequence("LogIds") - .StartsAt(1) - .IncrementsBy(1); - - modelBuilder.HasPostgresExtension("uuid-ossp"); - - modelBuilder.Entity(entity => - { - entity.ToTable("cs_SystemLog"); - entity.HasKey(p => p.Id); - - entity.Property(p => p.Id).IsRequired(); - - entity.Property(p => p.LogDateUtc).HasColumnName("LogDate"); - - entity.Property(p => p.IpAddress).HasMaxLength(50); - - entity.Property(p => p.Culture).HasMaxLength(10); - - entity.Property(p => p.ShortUrl).HasMaxLength(255); - - entity.Property(p => p.Thread).HasMaxLength(255); - - entity.Property(p => p.LogLevel).HasMaxLength(20); - - entity.Property(p => p.Logger).HasMaxLength(255); - - }); - - } - - } -} diff --git a/src/cloudscribe.Logging.EFCore.pgsql/LoggingDbContextDesignTimeFactory.cs b/src/cloudscribe.Logging.EFCore.pgsql/LoggingDbContextDesignTimeFactory.cs deleted file mode 100644 index b591b06..0000000 --- a/src/cloudscribe.Logging.EFCore.pgsql/LoggingDbContextDesignTimeFactory.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Design; - -namespace cloudscribe.Logging.EFCore.pgsql -{ - public class LoggingDbContextDesignTimeFactory : IDesignTimeDbContextFactory - { - public LoggingDbContext CreateDbContext(string[] args) - { - var builder = new DbContextOptionsBuilder(); - builder.UseNpgsql("server=yourservername;UID=yourdatabaseusername;PWD=yourdatabaseuserpassword;database=yourdatabasename"); - - return new LoggingDbContext(builder.Options); - } - } -} diff --git a/src/cloudscribe.Logging.EFCore.pgsql/LoggingDbContextFactory.cs b/src/cloudscribe.Logging.EFCore.pgsql/LoggingDbContextFactory.cs deleted file mode 100644 index 5d4682b..0000000 --- a/src/cloudscribe.Logging.EFCore.pgsql/LoggingDbContextFactory.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.EntityFrameworkCore; - -namespace cloudscribe.Logging.EFCore.pgsql -{ - public class LoggingDbContextFactory : ILoggingDbContextFactory - { - public LoggingDbContextFactory(DbContextOptions options) - { - dbContextOptions = options; - } - - private DbContextOptions dbContextOptions; - - public ILoggingDbContext CreateContext() - { - return new LoggingDbContext(dbContextOptions); - } - } -} diff --git a/src/cloudscribe.Logging.EFCore.pgsql/Migrations/20170204141918_Initial.Designer.cs b/src/cloudscribe.Logging.EFCore.pgsql/Migrations/20170204141918_Initial.Designer.cs deleted file mode 100644 index 1db280c..0000000 --- a/src/cloudscribe.Logging.EFCore.pgsql/Migrations/20170204141918_Initial.Designer.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using System; - -namespace cloudscribe.Logging.EFCore.pgsql.Migrations -{ - [DbContext(typeof(LoggingDbContext))] - [Migration("20170204141918_Initial")] - partial class Initial - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { - modelBuilder - .HasAnnotation("Npgsql:PostgresExtension:uuid-ossp", "'uuid-ossp', '', ''") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn) - .HasAnnotation("ProductVersion", "1.1.0-rtm-22752") - .HasAnnotation("Relational:Sequence:.LogIds", "'LogIds', '', '1', '1', '', '', 'Int64', 'False'"); - - modelBuilder.Entity("cloudscribe.Logging.Web.LogItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Culture") - .HasMaxLength(10); - - b.Property("EventId"); - - b.Property("IpAddress") - .HasMaxLength(50); - - b.Property("LogDateUtc") - .HasColumnName("LogDate"); - - b.Property("LogLevel") - .HasMaxLength(20); - - b.Property("Logger") - .HasMaxLength(255); - - b.Property("Message"); - - b.Property("ShortUrl") - .HasMaxLength(255); - - b.Property("StateJson"); - - b.Property("Thread") - .HasMaxLength(255); - - b.Property("Url"); - - b.HasKey("Id"); - - b.ToTable("cs_SystemLog"); - }); - } - } -} diff --git a/src/cloudscribe.Logging.EFCore.pgsql/Migrations/20170204141918_Initial.cs b/src/cloudscribe.Logging.EFCore.pgsql/Migrations/20170204141918_Initial.cs deleted file mode 100644 index 6898206..0000000 --- a/src/cloudscribe.Logging.EFCore.pgsql/Migrations/20170204141918_Initial.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace cloudscribe.Logging.EFCore.pgsql.Migrations -{ - public partial class Initial : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterDatabase() - .Annotation("Npgsql:PostgresExtension:uuid-ossp", "'uuid-ossp', '', ''"); - - migrationBuilder.CreateSequence( - name: "LogIds"); - - migrationBuilder.CreateTable( - name: "cs_SystemLog", - columns: table => new - { - Id = table.Column(nullable: false), - Culture = table.Column(maxLength: 10, nullable: true), - EventId = table.Column(nullable: false), - IpAddress = table.Column(maxLength: 50, nullable: true), - LogDate = table.Column(nullable: false), - LogLevel = table.Column(maxLength: 20, nullable: true), - Logger = table.Column(maxLength: 255, nullable: true), - Message = table.Column(nullable: true), - ShortUrl = table.Column(maxLength: 255, nullable: true), - StateJson = table.Column(nullable: true), - Thread = table.Column(maxLength: 255, nullable: true), - Url = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_cs_SystemLog", x => x.Id); - }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "cs_SystemLog"); - - migrationBuilder.DropSequence( - name: "LogIds"); - } - } -} diff --git a/src/cloudscribe.Logging.EFCore.pgsql/Migrations/LoggingDbContextModelSnapshot.cs b/src/cloudscribe.Logging.EFCore.pgsql/Migrations/LoggingDbContextModelSnapshot.cs deleted file mode 100644 index b093a20..0000000 --- a/src/cloudscribe.Logging.EFCore.pgsql/Migrations/LoggingDbContextModelSnapshot.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using System; - -namespace cloudscribe.Logging.EFCore.pgsql.Migrations -{ - [DbContext(typeof(LoggingDbContext))] - partial class LoggingDbContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { - modelBuilder - .HasAnnotation("Npgsql:PostgresExtension:uuid-ossp", "'uuid-ossp', '', ''") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn) - .HasAnnotation("ProductVersion", "1.1.0-rtm-22752") - .HasAnnotation("Relational:Sequence:.LogIds", "'LogIds', '', '1', '1', '', '', 'Int64', 'False'"); - - modelBuilder.Entity("cloudscribe.Logging.Web.LogItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Culture") - .HasMaxLength(10); - - b.Property("EventId"); - - b.Property("IpAddress") - .HasMaxLength(50); - - b.Property("LogDateUtc") - .HasColumnName("LogDate"); - - b.Property("LogLevel") - .HasMaxLength(20); - - b.Property("Logger") - .HasMaxLength(255); - - b.Property("Message"); - - b.Property("ShortUrl") - .HasMaxLength(255); - - b.Property("StateJson"); - - b.Property("Thread") - .HasMaxLength(255); - - b.Property("Url"); - - b.HasKey("Id"); - - b.ToTable("cs_SystemLog"); - }); - } - } -} diff --git a/src/cloudscribe.Logging.EFCore.pgsql/README.md b/src/cloudscribe.Logging.EFCore.pgsql/README.md deleted file mode 100644 index fcb9127..0000000 --- a/src/cloudscribe.Logging.EFCore.pgsql/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# cloudscribe.Logging.EFCore.pgsql - -## How to generate migrations - -Since this project is a netstandard20 class library it is not executable, therefore you have to pass in the --startup-project that is executable - -dotnet ef --startup-project ../Demo.WebApp migrations add [Migration Name] --context cloudscribe.Logging.EFCore.pgsql.LoggingDbContext \ No newline at end of file diff --git a/src/cloudscribe.Logging.EFCore.pgsql/ServiceCollectionExtensions.cs b/src/cloudscribe.Logging.EFCore.pgsql/ServiceCollectionExtensions.cs deleted file mode 100644 index 83dee43..0000000 --- a/src/cloudscribe.Logging.EFCore.pgsql/ServiceCollectionExtensions.cs +++ /dev/null @@ -1,59 +0,0 @@ -using cloudscribe.Logging; -using cloudscribe.Logging.EFCore; -using cloudscribe.Logging.EFCore.Common; -using cloudscribe.Logging.EFCore.pgsql; -using cloudscribe.Logging.Models; -using cloudscribe.Versioning; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection.Extensions; -using System; -using System.Collections.Generic; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static class ServiceCollectionExtensions - { - public static IServiceCollection AddCloudscribeLoggingEFStoragePostgreSql( - this IServiceCollection services, - string connectionString, - int maxConnectionRetryCount = 0, - int maxConnectionRetryDelaySeconds = 30, - ICollection transientErrorCodesToAdd = null - ) - { - - // AddEntityFrameworkNpgsql call should be deprecated: - // https://www.npgsql.org/efcore/api/Microsoft.Extensions.DependencyInjection.NpgsqlServiceCollectionExtensions.html - - services - .AddDbContext(options => - options.UseNpgsql(connectionString, - npgsqlOptionsAction: sqlOptions => - { - sqlOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery); // pagination likely here - - if (maxConnectionRetryCount > 0) - { - //Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency - sqlOptions.EnableRetryOnFailure( - maxRetryCount: maxConnectionRetryCount, - maxRetryDelay: TimeSpan.FromSeconds(maxConnectionRetryDelaySeconds), - errorCodesToAdd: transientErrorCodesToAdd); - } - }), - optionsLifetime: ServiceLifetime.Singleton - ); - - - - services.TryAddScoped(); - services.AddCloudscribeLoggingEFCommon(); - services.AddScoped(); - services.AddSingleton(); - services.AddScoped(); - services.AddScoped(); - - return services; - } - } -} diff --git a/src/cloudscribe.Logging.EFCore.pgsql/Truncator.cs b/src/cloudscribe.Logging.EFCore.pgsql/Truncator.cs deleted file mode 100644 index 2b9cb34..0000000 --- a/src/cloudscribe.Logging.EFCore.pgsql/Truncator.cs +++ /dev/null @@ -1,24 +0,0 @@ -using cloudscribe.Logging.EFCore.Common; -using Microsoft.EntityFrameworkCore; -using System.Threading.Tasks; - -namespace cloudscribe.Logging.EFCore.pgsql -{ - public class Truncator : ITruncateLog - { - public Truncator(ILoggingDbContextFactory loggingDbContextFactory) - { - _contextFactory = loggingDbContextFactory; - } - - private readonly ILoggingDbContextFactory _contextFactory; - - public async Task TruncateLog() - { - using (var db = _contextFactory.CreateContext()) - { - await db.Database.ExecuteSqlRawAsync("TRUNCATE TABLE \"cs_SystemLog\"; "); - } - } - } -} diff --git a/src/cloudscribe.Logging.EFCore.pgsql/VersionProvider.cs b/src/cloudscribe.Logging.EFCore.pgsql/VersionProvider.cs deleted file mode 100644 index a4d21be..0000000 --- a/src/cloudscribe.Logging.EFCore.pgsql/VersionProvider.cs +++ /dev/null @@ -1,36 +0,0 @@ -using cloudscribe.Versioning; -using System; -using System.Reflection; - -namespace cloudscribe.Logging.EFCore.pgsql -{ - public class VersionProvider : IVersionProvider - { - private Assembly assembly = typeof(LoggingDbContext).Assembly; - - public string Name - { - get { return assembly.GetName().Name; } - - } - - public Guid ApplicationId { get { return new Guid("1ed49467-fbd7-43f4-b8ae-5e78294ed071"); } } - - public Version CurrentVersion - { - - get - { - - var version = new Version(2, 0, 0, 0); - var versionString = assembly.GetCustomAttribute().Version; - if (!string.IsNullOrWhiteSpace(versionString)) - { - Version.TryParse(versionString, out version); - } - - return version; - } - } - } -} diff --git a/src/cloudscribe.Logging.EFCore.pgsql/cloudscribe.Logging.EFCore.pgsql.csproj b/src/cloudscribe.Logging.EFCore.pgsql/cloudscribe.Logging.EFCore.pgsql.csproj deleted file mode 100644 index cff3709..0000000 --- a/src/cloudscribe.Logging.EFCore.pgsql/cloudscribe.Logging.EFCore.pgsql.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - PostgreSql Entity Framework Core implementation of cloudscribe ILogRepository - 8.4.0 - net8.0 - Joe Audette - cloudscribe;repositories;logging - icon.png - https://github.com/joeaudette/cloudscribe.Logging - Apache-2.0 - README.md - https://github.com/cloudscribe/cloudscribe.Logging.git - git - - - - - - - - - - - - - - - - - - - - - diff --git a/src/cloudscribe.Logging.EFCore.pgsql/icon.png b/src/cloudscribe.Logging.EFCore.pgsql/icon.png deleted file mode 100644 index 33d36a2..0000000 Binary files a/src/cloudscribe.Logging.EFCore.pgsql/icon.png and /dev/null differ