Skip to content

Commit

Permalink
Merge pull request #247 from sharparchitecture/releases/7.0.0
Browse files Browse the repository at this point in the history
v 7.0.0
  • Loading branch information
cd21h authored May 31, 2021
2 parents 9a8cd33 + 90b35b4 commit 87ffca5
Show file tree
Hide file tree
Showing 143 changed files with 2,147 additions and 2,873 deletions.
17 changes: 10 additions & 7 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
<Product>Sharp Architecture</Product>
<Authors>Sharp Architecture Dev Team</Authors>

<TargetFrameworks>netstandard2.0;netstandard2.1;net5</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0</TargetFrameworks>
<SignAssembly>false</SignAssembly>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>

<LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable>
<IsTestProject>false</IsTestProject>
</PropertyGroup>

<PropertyGroup Label="Custom targeTs">
<PropertyGroup Label="Custom targets">
<!-- target frameworks for unit-tests and applications -->
<AppTargetFrameworks>netcoreapp2.1;netcoreapp2.2;netcoreapp3.1;net5</AppTargetFrameworks>
<AppTargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0</AppTargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
Expand All @@ -27,16 +28,18 @@
<Optimize>True</Optimize>
</PropertyGroup>

<!-- nullable checks -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'net5.0' ">
<DefineConstants>$(DefineConstants);NULLABLE_REFERENCE_TYPES</DefineConstants>
</PropertyGroup>

<PropertyGroup Label="Package" Condition="'$(MSBuildProjectName.Contains(Tests))' == false">
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
<IsPackable>True</IsPackable>
<PackageIconUrl>https://github.com/sharparchitecture/Sharp-Architecture/raw/master/Artefacts/Documentation/icon.png</PackageIconUrl>
<PackageProjectUrl>http://sharparchitecture.github.io/</PackageProjectUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>https://github.com/sharparchitecture/Sharp-Architecture/releases/tag/6.1.1</PackageReleaseNotes>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageReleaseNotes>https://github.com/sharparchitecture/Sharp-Architecture/releases/tag/7.0.0</PackageReleaseNotes>
<PackageTags>sharp-architecture;sharp-arch</PackageTags>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion Docker/start-mssql.ps1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docker.exe run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Password12!' -p 2433:1433 -d -v./mssql-data:/var/opt/mssql/data mcr.microsoft.com/mssql/server:2017-latest-ubuntu
docker.exe run --name sharparch-sql -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Password12!' -p 2433:1433 -d -v./mssql-data:/var/opt/mssql/data mcr.microsoft.com/mssql/server:2017-latest-ubuntu
1 change: 1 addition & 0 deletions GitReleaseManager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ issue-labels-exclude:
- question
- ready
- wontfix
- pull-request

issue-labels-alias:
- name: breaking-change
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class AnnouncementSummary

[Required]
[JsonProperty("title")]
public string Title { get; set; }
public string Title { get; set; } = null!;
}


Expand All @@ -30,6 +30,6 @@ public class AnnouncementModel : AnnouncementSummary
{
[JsonProperty("content")]
[Required]
public string Content { get; set; }
public string Content { get; set; } = null!;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public class NewAnnouncement

[Required]
[JsonProperty("title")]
public string Title { get; set; }
public string Title { get; set; } = null!;

[JsonProperty("content")]
[Required]
public string Content { get; set; }
public string Content { get; set; } = null!;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2020.3.0" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="JetBrains.Annotations" Version="2021.1.0" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions Samples/TardisBank/Src/Suteki.TardisBank.Domain/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Suteki.TardisBank.Domain

using SharpArch.Domain.DomainModel;

public class Account : Entity
public class Account : Entity<int>
{
public const int MaxTransactions = 100;
public virtual decimal OldTransactionsBalance { get; protected set; }
Expand All @@ -27,7 +27,7 @@ public virtual decimal Balance

public virtual IList<PaymentSchedule> PaymentSchedules { get; protected set; }

public virtual void AddTransaction(string description, decimal amount)
public virtual void AddTransaction(string? description, decimal amount)
{
this.Transactions.Add(new Transaction(description, amount, this));

Expand Down Expand Up @@ -66,4 +66,4 @@ public virtual void RemovePaymentSchedule(int paymentScheduleId)
this.PaymentSchedules.Remove(scheduleToRemove);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
using SharpArch.Domain.DomainModel;

[DebuggerDisplay("{Id}: {Title}")]
public class Announcement: Entity
public class Announcement: Entity<int>
{
public virtual DateTime Date { get; set; }

[MaxLength(120)]
public virtual string Title { get; set; }
public virtual string Title { get; set; } = null!;

[MaxLength(2000)]
public virtual string Content { get; set; }
public virtual string? Content { get; set; }

public virtual DateTime LastModifiedUtc { get; set; }

Expand Down
4 changes: 2 additions & 2 deletions Samples/TardisBank/Src/Suteki.TardisBank.Domain/Child.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected Child()
}

public virtual int ParentId { get; set; }
public virtual Account Account { get; set; }
public virtual Account Account { get; set; } = null!;

public virtual void ReceivePayment(decimal amount, string description)
{
Expand Down Expand Up @@ -75,4 +75,4 @@ public override string[] GetRoles()
return new[] { UserRoles.Child };
}
}
}
}
8 changes: 4 additions & 4 deletions Samples/TardisBank/Src/Suteki.TardisBank.Domain/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Suteki.TardisBank.Domain

using SharpArch.Domain.DomainModel;

public class Message : Entity
public class Message : Entity<int>
{
public Message(DateTime date, string text, User user)
{
Expand All @@ -24,10 +24,10 @@ public virtual void Read()
}

public virtual DateTime Date { get; protected set; }
public virtual string Text { get; protected set; }
public virtual string? Text { get; protected set; }

public virtual User User { get; set; }
public virtual User User { get; set; } = null!;

public virtual bool HasBeenRead { get; protected set; }
}
}
}
8 changes: 5 additions & 3 deletions Samples/TardisBank/Src/Suteki.TardisBank.Domain/Parent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ protected Parent()
{
}

public virtual IList<Child> Children { get; protected set; }
public virtual string ActivationKey { get; protected set; }
public virtual IList<Child> Children { get; protected set; } = null!;

public virtual string ActivationKey { get; protected set; } = null!;

// should be called when parent is first created.
public virtual Parent Initialise(IMediator mediator)
{
Expand Down Expand Up @@ -69,7 +71,7 @@ public virtual bool HasChild(int childId)

public virtual void RemoveChild(int childId)
{
Child childToRemove = this.Children.SingleOrDefault(x => x.Id == childId);
Child? childToRemove = this.Children.SingleOrDefault(x => x.Id == childId);
if (childToRemove != null)
{
this.Children.Remove(childToRemove);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using SharpArch.Domain.DomainModel;

public class PaymentSchedule : Entity
public class PaymentSchedule : Entity<int>
{
public PaymentSchedule(DateTime nextRun, Interval interval, decimal amount, string description, Account account)
{
Expand All @@ -22,9 +22,9 @@ protected PaymentSchedule()
public virtual DateTime NextRun { get; protected set; }
public virtual Interval Interval { get; protected set; }
public virtual decimal Amount { get; protected set; }
public virtual string Description { get; protected set; }
public virtual string? Description { get; protected set; }

public virtual Account Account { get; protected set; }
public virtual Account Account { get; protected set; } = null!;

public virtual void CalculateNextRunDate()
{
Expand All @@ -42,4 +42,4 @@ public virtual void CalculateNextRunDate()
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2020.3.0" />
<PackageReference Include="JetBrains.Annotations" Version="2021.1.0" />
<PackageReference Include="MediatR" Version="9.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions Samples/TardisBank/Src/Suteki.TardisBank.Domain/Transaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ namespace Suteki.TardisBank.Domain

using SharpArch.Domain.DomainModel;

public class Transaction : Entity
public class Transaction : Entity<int>
{
public Transaction(string description, decimal amount, Account account)
public Transaction(string? description, decimal amount, Account account)
{
this.Description = description;
this.Amount = amount;
Expand All @@ -18,11 +18,11 @@ protected Transaction()
{
}

public virtual string Description { get; protected set; }
public virtual string? Description { get; protected set; }
public virtual decimal Amount { get; protected set; }

public virtual Account Account { get; protected set; }
public virtual Account Account { get; protected set; } = null!;

public virtual DateTime Date { get; protected set; }
}
}
}
12 changes: 6 additions & 6 deletions Samples/TardisBank/Src/Suteki.TardisBank.Domain/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ public static class UserRoles
public const string Parent = "Parent";
}

public abstract class User : Entity
public abstract class User : Entity<int>
{
public const int MaxMessages = 20;

protected User()
{
}

public virtual string Name { get; protected set; }
public virtual string UserName { get; protected set; }
public virtual string Password { get; protected set; }
public virtual string Name { get; protected set; } = null!;
public virtual string UserName { get; protected set; } = null!;
public virtual string Password { get; protected set; } = null!;
public virtual bool IsActive { get; protected set; }
public virtual IList<Message> Messages { get; protected set; }
public virtual IList<Message> Messages { get; protected set; } = null!;

protected User(string name, string userName, string password)
{
Expand Down Expand Up @@ -94,4 +94,4 @@ public virtual string[] GetRoles()
return new string[0];
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
namespace Suteki.TardisBank.Infrastructure.NHibernateMaps
{
/// <summary>
/// Generates the automapping for the domain assembly
/// Generates the auto-mapping for the domain assembly
/// </summary>
public class AutoPersistenceModelGenerator : IAutoPersistenceModelGenerator
{
public AutoPersistenceModel Generate()
{
var mappings = AutoMap.AssemblyOf<Child>(new AutomappingConfiguration());
mappings.IgnoreBase<Entity>();
mappings.IgnoreBase(typeof(EntityWithTypedId<>));
mappings.IgnoreBase(typeof(Entity<>));
mappings.Conventions.Setup(GetConventions());
mappings.UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ public class AutomappingConfiguration : DefaultAutomappingConfiguration
/// <inheritdoc />
public override bool ShouldMap(System.Type type)
{
return type.GetInterfaces().Any(x =>
x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IEntityWithTypedId<>));
return type.GetInterfaces().Any(x => x == typeof(IEntity));
}

/// <inheritdoc />
Expand All @@ -26,7 +25,7 @@ public override bool ShouldMap(Member member)
/// <inheritdoc />
public override bool AbstractClassIsLayerSupertype(System.Type type)
{
return type == typeof(EntityWithTypedId<>) || type == typeof(Entity);
return type == typeof(Entity<>);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="FluentNHibernate" Version="3.1.0" />
<PackageReference Include="Humanizer.Core" Version="2.8.26" />
<PackageReference Include="Iesi.Collections" Version="4.0.4" />
<PackageReference Include="JetBrains.Annotations" Version="2020.3.0" />
<PackageReference Include="NHibernate" Version="5.3.5" />
<PackageReference Include="JetBrains.Annotations" Version="2021.1.0" />
<PackageReference Include="NHibernate" Version="5.3.8" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ namespace Suteki.TardisBank.Tasks

public interface IUserService
{
Task<User> GetCurrentUser(CancellationToken cancellationToken = default);
Task<User?> GetCurrentUser(CancellationToken cancellationToken = default);
Task<User> GetUser(int userId, CancellationToken cancellationToken = default);
Task<User> GetUserByUserName(string userName, CancellationToken cancellationToken = default);
Task<User> GetUserByActivationKey(string activationKey, CancellationToken cancellationToken = default);
Task<User?> GetUserByUserName(string userName, CancellationToken cancellationToken = default);
Task<User?> GetUserByActivationKey(string activationKey, CancellationToken cancellationToken = default);
Task SaveUser(User user, CancellationToken cancellationToken = default);
Task DeleteUser(int userId, CancellationToken cancellationToken = default);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Iesi.Collections" Version="4.0.4" />
<PackageReference Include="JetBrains.Annotations" Version="2020.3.0" />
<PackageReference Include="JetBrains.Annotations" Version="2021.1.0" />
<PackageReference Include="MediatR" Version="9.0.0" />
<PackageReference Include="NHibernate" Version="5.3.5" />
<PackageReference Include="NHibernate" Version="5.3.8" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 87ffca5

Please sign in to comment.