Skip to content

Commit

Permalink
Assembly Filter and Nullable updates (#179)
Browse files Browse the repository at this point in the history
* Date Range Label property nullable

closes #160

* Changed methods to handle nullable

closes #170

* removed all null warnings for OLT.EF.Core.SqlServer

closes #171

* removed null warnings from OLT.EF.Core

closes #172

* removed null warnings from OLT.Core.Common.Abstractions

closes #173

* added GetEmbeddedResourceStreamSafe

closes #175

* Removed null reference OLT.EF.Core.SeedHelpers.Csv warnings

closes #174

* general cleanup of test null

* Enabled nullable for OLT.DataAdapters.AutoMapper & OLT.DataAdapters

closes #177

* Assembly Filter

closes #176

* General Nullable updates

* move SendGrid to new repo

closes #178

* code coverage and smells

* Tweaks to assembly scan for asp.net core

* minor nullable tweaks
  • Loading branch information
chrisstraw committed Mar 10, 2024
1 parent beec58b commit a5b0097
Show file tree
Hide file tree
Showing 261 changed files with 1,378 additions and 5,956 deletions.
43 changes: 0 additions & 43 deletions OLT.Core.sln
Expand Up @@ -8,28 +8,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OLT.Core.Common", "src\OLT.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OLT.Core.Common.Tests", "tests\OLT.Core.Common.Tests\OLT.Core.Common.Tests.csproj", "{ECE9EA77-25B7-422E-A673-1C7622DE1406}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OLT.Email", "OLT.Email", "{F6D85F54-C3A1-4698-B671-1AA2B7304C32}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OLT.Email.Tests", "tests\OLT.Email.Tests\OLT.Email.Tests.csproj", "{666033FB-83B6-4861-8EF0-B1B5C5816BFA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OLT.Email", "src\OLT.Email\OLT.Email.csproj", "{98759DA5-5EC5-4090-B8CE-BCE55737FE8F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OLT.Email.SendGrid", "OLT.Email.SendGrid", "{B88D2009-30C8-4B4A-9BD3-999746786D0B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OLT.Email.SendGrid.Shared", "src\OLT.Email.SendGrid.Shared\OLT.Email.SendGrid.Shared.csproj", "{98D1636A-58C3-4EA5-9153-21A8699910C8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OLT.Email.SendGrid", "src\OLT.Email.SendGrid\OLT.Email.SendGrid.csproj", "{4253995B-2ED9-4723-AE76-3D9B1DD57852}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OLT.Email.SendGrid.Tests", "tests\OLT.Email.SendGrid.Tests\OLT.Email.SendGrid.Tests.csproj", "{7037E517-0DAD-42BD-8372-933F98B2B638}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OLT.Extensions.General", "OLT.Extensions.General", "{47CD24FC-21E0-4840-A056-6C147B8E1131}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OLT.Extensions.General", "src\OLT.Extensions.General\OLT.Extensions.General.csproj", "{545BCC71-DBCB-4943-8E23-6C82A16B624B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OLT.Extensions.General.Tests", "tests\OLT.Extensions.General.Tests\OLT.Extensions.General.Tests.csproj", "{D74F7A17-B8D1-41A8-854E-556659696DB7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{B92AEA04-CEC7-49E8-9466-7786562629B8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OLT.Logging.Serilog", "OLT.Logging.Serilog", "{4812A791-0A74-44F5-AA37-448BD5383F53}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OLT.Logging.Serilog", "src\OLT.Logging.Serilog\OLT.Logging.Serilog.csproj", "{9440CDFD-7A66-4EEB-9BDB-4CB4537CAC49}"
Expand Down Expand Up @@ -200,26 +184,6 @@ Global
{ECE9EA77-25B7-422E-A673-1C7622DE1406}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ECE9EA77-25B7-422E-A673-1C7622DE1406}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ECE9EA77-25B7-422E-A673-1C7622DE1406}.Release|Any CPU.Build.0 = Release|Any CPU
{666033FB-83B6-4861-8EF0-B1B5C5816BFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{666033FB-83B6-4861-8EF0-B1B5C5816BFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{666033FB-83B6-4861-8EF0-B1B5C5816BFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{666033FB-83B6-4861-8EF0-B1B5C5816BFA}.Release|Any CPU.Build.0 = Release|Any CPU
{98759DA5-5EC5-4090-B8CE-BCE55737FE8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{98759DA5-5EC5-4090-B8CE-BCE55737FE8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{98759DA5-5EC5-4090-B8CE-BCE55737FE8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{98759DA5-5EC5-4090-B8CE-BCE55737FE8F}.Release|Any CPU.Build.0 = Release|Any CPU
{98D1636A-58C3-4EA5-9153-21A8699910C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{98D1636A-58C3-4EA5-9153-21A8699910C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{98D1636A-58C3-4EA5-9153-21A8699910C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{98D1636A-58C3-4EA5-9153-21A8699910C8}.Release|Any CPU.Build.0 = Release|Any CPU
{4253995B-2ED9-4723-AE76-3D9B1DD57852}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4253995B-2ED9-4723-AE76-3D9B1DD57852}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4253995B-2ED9-4723-AE76-3D9B1DD57852}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4253995B-2ED9-4723-AE76-3D9B1DD57852}.Release|Any CPU.Build.0 = Release|Any CPU
{7037E517-0DAD-42BD-8372-933F98B2B638}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7037E517-0DAD-42BD-8372-933F98B2B638}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7037E517-0DAD-42BD-8372-933F98B2B638}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7037E517-0DAD-42BD-8372-933F98B2B638}.Release|Any CPU.Build.0 = Release|Any CPU
{545BCC71-DBCB-4943-8E23-6C82A16B624B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{545BCC71-DBCB-4943-8E23-6C82A16B624B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{545BCC71-DBCB-4943-8E23-6C82A16B624B}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -443,15 +407,8 @@ Global
GlobalSection(NestedProjects) = preSolution
{C67E4CE8-86F5-4A30-B5A1-F6057E11CB8A} = {F78D6857-D3FF-48CF-B62C-51E893FEDF65}
{ECE9EA77-25B7-422E-A673-1C7622DE1406} = {F78D6857-D3FF-48CF-B62C-51E893FEDF65}
{666033FB-83B6-4861-8EF0-B1B5C5816BFA} = {B92AEA04-CEC7-49E8-9466-7786562629B8}
{98759DA5-5EC5-4090-B8CE-BCE55737FE8F} = {B92AEA04-CEC7-49E8-9466-7786562629B8}
{B88D2009-30C8-4B4A-9BD3-999746786D0B} = {F6D85F54-C3A1-4698-B671-1AA2B7304C32}
{98D1636A-58C3-4EA5-9153-21A8699910C8} = {B88D2009-30C8-4B4A-9BD3-999746786D0B}
{4253995B-2ED9-4723-AE76-3D9B1DD57852} = {B88D2009-30C8-4B4A-9BD3-999746786D0B}
{7037E517-0DAD-42BD-8372-933F98B2B638} = {B88D2009-30C8-4B4A-9BD3-999746786D0B}
{545BCC71-DBCB-4943-8E23-6C82A16B624B} = {47CD24FC-21E0-4840-A056-6C147B8E1131}
{D74F7A17-B8D1-41A8-854E-556659696DB7} = {47CD24FC-21E0-4840-A056-6C147B8E1131}
{B92AEA04-CEC7-49E8-9466-7786562629B8} = {F6D85F54-C3A1-4698-B671-1AA2B7304C32}
{9440CDFD-7A66-4EEB-9BDB-4CB4537CAC49} = {4812A791-0A74-44F5-AA37-448BD5383F53}
{5BE2A5C9-48D0-4969-BF19-6F8B29A784E3} = {4812A791-0A74-44F5-AA37-448BD5383F53}
{062B739C-B550-4142-A56F-B2E8695A382F} = {FC12AA4E-E1A3-4893-95F0-2230525468F2}
Expand Down
11 changes: 8 additions & 3 deletions README.md
Expand Up @@ -22,9 +22,6 @@
| [OLT.EF.Core.SeedHelpers.Csv](./src/OLT.EF.Core.SeedHelpers.Csv/) | [![Nuget](https://img.shields.io/nuget/v/OLT.EF.Core.SeedHelpers.Csv)](https://www.nuget.org/packages/OLT.EF.Core.SeedHelpers.Csv) |
| [OLT.EF.Core.Services](./src/OLT.EF.Core.Services/) | [![Nuget](https://img.shields.io/nuget/v/OLT.EF.Core.Services)](https://www.nuget.org/packages/OLT.EF.Core.Services) |
| [OLT.EF.Core.SqlServer](./src/OLT.EF.Core.SqlServer/) | [![Nuget](https://img.shields.io/nuget/v/OLT.EF.Core.SqlServer)](https://www.nuget.org/packages/OLT.EF.Core.SqlServer) |
| [OLT.Email](./src/OLT.Email/) | [![Nuget](https://img.shields.io/nuget/v/OLT.Email)](https://www.nuget.org/packages/OLT.Email) |
| [OLT.Email.SendGrid](./src/OLT.Email.SendGrid/) | [![Nuget](https://img.shields.io/nuget/v/OLT.Email.SendGrid)](https://www.nuget.org/packages/OLT.Email.SendGrid) |
| [OLT.Email.SendGrid.Shared](./src/OLT.Email.SendGrid.Shared/) | [![Nuget](https://img.shields.io/nuget/v/OLT.Email.SendGrid.Shared)](https://www.nuget.org/packages/OLT.Email.SendGrid.Shared) |
| [OLT.EPPlus](./src/OLT.EPPlus/) | [![Nuget](https://img.shields.io/nuget/v/OLT.EPPlus)](https://www.nuget.org/packages/OLT.EPPlus) |
| [OLT.Extensions.Caching.Memory](./src/OLT.Extensions.Caching.Memory/) | [![Nuget](https://img.shields.io/nuget/v/OLT.Extensions.Caching.Memory)](https://www.nuget.org/packages/OLT.Extensions.Caching.Memory) |
| [OLT.Extensions.Caching.Redis](./src/OLT.Extensions.Caching.Redis/) | [![Nuget](https://img.shields.io/nuget/v/OLT.Extensions.Caching.Redis)](https://www.nuget.org/packages/OLT.Extensions.Caching.Redis) |
Expand All @@ -42,6 +39,14 @@

---

## MOVED TO NEW REPO

| Library | New Repo |
| ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| [OLT.Email](./src/OLT.Email/) | [https://github.com/OuterlimitsTech/olt-sendgrid](https://github.com/OuterlimitsTech/olt-sendgrid) |
| [OLT.Email.SendGrid](./src/OLT.Email.SendGrid/) | [https://github.com/OuterlimitsTech/olt-sendgrid](https://github.com/OuterlimitsTech/olt-sendgrid) |
| [OLT.Email.SendGrid.Shared](./src/OLT.Email.SendGrid.Shared/) | [https://github.com/OuterlimitsTech/olt-sendgrid](https://github.com/OuterlimitsTech/olt-sendgrid) |

## DEPRECATED LIBRARIES

| Library | Version | Notes |
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Expand Up @@ -5,7 +5,7 @@
<Company>OuterLimits Technologies, Inc</Company>
<Product>OLT Core Libraries</Product>
<Authors>Chris Straw</Authors>
<Copyright>Copyright © 2003-2023, OuterLimits Technologies, Inc Plainfield, IN</Copyright>
<Copyright>Copyright © 2003-2024, OuterLimits Technologies, Inc Plainfield, IN</Copyright>
<RepositoryUrl>https://github.com/OuterlimitsTech/olt-dotnet-core</RepositoryUrl>
<PackageIcon>icon.png</PackageIcon>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
Expand Down
6 changes: 4 additions & 2 deletions src/OLT.AspNetCore/Extensions/OltHttpRequestExtensions.cs
Expand Up @@ -106,7 +106,8 @@ public static OltGenericParameter ToOltGenericParameter(this HttpRequest request
public static OltGenericParameter ToOltGenericParameter(this RouteValueDictionary value)
{
ArgumentNullException.ThrowIfNull(value);
return new OltGenericParameter(value.ToDictionary(k => k.Key, v => v.Value?.ToString()));
var values = value.ToDictionary(k => k.Key, v => v.Value?.ToString() ?? string.Empty);
return new OltGenericParameter(values);
}

/// <summary>
Expand All @@ -121,7 +122,8 @@ public static OltGenericParameter ToOltGenericParameter(this RouteValueDictionar
public static OltGenericParameter ToOltGenericParameter(this IQueryCollection value)
{
ArgumentNullException.ThrowIfNull(value);
return new OltGenericParameter(value.ToDictionary(k => k.Key, v => v.Value.ToString()));
var values = value.ToDictionary(k => k.Key, v => v.Value.ToString());
return new OltGenericParameter(values);
}

/// <summary>
Expand Down
Expand Up @@ -2,12 +2,12 @@
using System.Collections.Generic;
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.VisualBasic;

namespace OLT.Core
{
public static class OltServiceCollectionAspnetCoreExtensions
{

/// <summary>
/// Build Default AspNetCore Service and configures Dependency Injection
/// </summary>
Expand All @@ -16,7 +16,19 @@ public static class OltServiceCollectionAspnetCoreExtensions
/// <returns></returns>
public static IServiceCollection AddOltAspNetCore(this IServiceCollection services, Action<IMvcBuilder>? action = null)
{
return AddOltAspNetCore(services, new List<Assembly>(), action);
return AddOltAspNetCore(services, new OltInjectionAssemblyFilter(), action);
}

/// <summary>
/// Build Default AspNetCore Service and configures Dependency Injection
/// </summary>
/// <param name="services"></param>
/// <param name="action">Invoked after initialized</param>
/// <param name="filter">Assembly Filter</param>
/// <returns></returns>
public static IServiceCollection AddOltAspNetCore(this IServiceCollection services, OltInjectionAssemblyFilter filter, Action<IMvcBuilder>? action = null)
{
return AddOltAspNetCore(services, new List<Assembly>(), filter, action);
}

/// <summary>
Expand All @@ -27,12 +39,25 @@ public static IServiceCollection AddOltAspNetCore(this IServiceCollection servic
/// <param name="action">Invoked after initialized</param>
/// <returns></returns>
public static IServiceCollection AddOltAspNetCore(this IServiceCollection services, Assembly baseAssembly, Action<IMvcBuilder>? action = null)
{
return AddOltAspNetCore(services, baseAssembly, new OltInjectionAssemblyFilter(), action);
}

/// <summary>
/// Build Default AspNetCore Service and configures Dependency Injection
/// </summary>
/// <param name="services"></param>
/// <param name="baseAssembly">Assembly to include in scan for interfaces</param>
/// <param name="action">Invoked after initialized</param>
/// <param name="filter">Assembly Filter</param>
/// <returns></returns>
public static IServiceCollection AddOltAspNetCore(this IServiceCollection services, Assembly baseAssembly, OltInjectionAssemblyFilter filter, Action<IMvcBuilder>? action = null)
{
if (baseAssembly == null)
{
throw new ArgumentNullException(nameof(baseAssembly));
}
return AddOltAspNetCore(services, new List<Assembly>() { baseAssembly }, action);
return AddOltAspNetCore(services, new List<Assembly>() { baseAssembly }, filter, action);
}

/// <summary>
Expand All @@ -43,6 +68,20 @@ public static IServiceCollection AddOltAspNetCore(this IServiceCollection servic
/// <param name="action">Invoked after initialized</param>
/// <returns></returns>
public static IServiceCollection AddOltAspNetCore(this IServiceCollection services, List<Assembly> baseAssemblies, Action<IMvcBuilder>? action = null)
{
return AddOltAspNetCore(services, baseAssemblies, new OltInjectionAssemblyFilter(), action);
}


/// <summary>
/// Build Default AspNetCore Service and configures Dependency Injection
/// </summary>
/// <param name="services"></param>
/// <param name="baseAssemblies">List of assemblies to include in scan for interfaces</param>
/// <param name="action">Invoked after initialized</param>
/// <param name="filter">Assembly Filter</param>
/// <returns></returns>
public static IServiceCollection AddOltAspNetCore(this IServiceCollection services, List<Assembly> baseAssemblies, OltInjectionAssemblyFilter filter, Action<IMvcBuilder>? action = null)
{

if (services == null)
Expand All @@ -64,7 +103,7 @@ public static IServiceCollection AddOltAspNetCore(this IServiceCollection servic

services
.AddCors(baseAssemblies)
.AddOltInjection(baseAssemblies)
.AddOltInjection(baseAssemblies, filter)
.AddSingleton<IOltHostService, OltHostAspNetCoreService>()
.AddScoped<IOltIdentity, OltIdentityAspNetCore>()
.AddScoped<IOltDbAuditUser>(x => x.GetRequiredService<IOltIdentity>())
Expand All @@ -75,9 +114,6 @@ public static IServiceCollection AddOltAspNetCore(this IServiceCollection servic

return services;
}




}
}
Expand Up @@ -41,7 +41,7 @@ public static IOrderedQueryable<T> OrderByPropertyName<T>(this IQueryable<T> que
/// <returns></returns>
public static IOrderedQueryable<T> OrderBy<T>(this IQueryable<T> queryable, IOltSortParams sortParams)
{
if (sortParams == null)
if (sortParams?.PropertyName == null)
{
throw new ArgumentNullException(nameof(sortParams));
}
Expand Down
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace OLT.Core
namespace OLT.Core
{
public class OltGenericParameter : IOltGenericParameter
{
Expand All @@ -28,7 +24,7 @@ public OltGenericParameter(Dictionary<string, string> values)
// Do Nothing
}
}
return default(T);
return default;
}


Expand All @@ -50,7 +46,7 @@ public OltGenericParameter(Dictionary<string, string> values)
return defaultValue;
}

public object GetValue(string key)
public string GetValue(string key)
{
return Values.FirstOrDefault(p => p.Key.Equals(key, StringComparison.OrdinalIgnoreCase)).Value;
}
Expand Down
Expand Up @@ -21,6 +21,6 @@ protected OltGenericParameterParser(string key)
public virtual string Key { get; } = default!;
public abstract bool HasValue { get; }
public abstract bool Parse(IOltGenericParameter parameters);
public virtual TValueType? Value { get; set; } = default(TValueType);
public virtual TValueType Value { get; set; } = default!;
}
}
Expand Up @@ -12,7 +12,7 @@ public interface IOltEntityCodeValue
/// <summary>
/// Code value caption. This is a short description usually used for picklist values.
/// </summary>
string? Name { get; set; }
string Name { get; set; }

}
}
Expand Up @@ -7,9 +7,9 @@ namespace OLT.Core
public interface IOltEntityIdService<TEntity> : IOltEntityService<TEntity>
where TEntity : class, IOltEntityId, IOltEntity
{
TModel Get<TModel>(int id, bool includeDeleted = false) where TModel : class, new();
TModel? Get<TModel>(int id, bool includeDeleted = false) where TModel : class, new();

Task<TModel> GetAsync<TModel>(int id, bool includeDeleted = false) where TModel : class, new();
Task<TModel?> GetAsync<TModel>(int id, bool includeDeleted = false) where TModel : class, new();

TModel Update<TModel>(int id, TModel model, Func<IQueryable<TEntity>, IQueryable<TEntity>>? include = null) where TModel : class, new();

Expand Down

0 comments on commit a5b0097

Please sign in to comment.