Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ else
vm.ModelPropertyChanged += async (s, e) => await InvokeAsync(() => StateHasChanged());

if (string.IsNullOrWhiteSpace(id))
await vm.RefreshAsync(() => personEditPortal.CreateAsync());
await vm.RefreshAsync(async () => (PersonEdit?)(await personEditPortal.CreateAsync()));
else
await vm.RefreshAsync(() => personEditPortal.FetchAsync(int.Parse(id)));
await vm.RefreshAsync(async () => (PersonEdit?)(await personEditPortal.FetchAsync(int.Parse(id))));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ else
vm.ModelPropertyChanged += async (s, e) => await InvokeAsync(() => StateHasChanged());

if (string.IsNullOrWhiteSpace(id))
await vm.RefreshAsync(() => personEditPortal.CreateAsync());
await vm.RefreshAsync(async () => (PersonEdit?)(await personEditPortal.CreateAsync()));
else
await vm.RefreshAsync(() => personEditPortal.FetchAsync(int.Parse(id)));
await vm.RefreshAsync(async () => (PersonEdit?)(await personEditPortal.FetchAsync(int.Parse(id))));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ else
{
// Every page _must_ initialize the state manager
await StateManager.InitializeAsync();
await vm.RefreshAsync(() => personListPortal.FetchAsync());
await vm.RefreshAsync(async () => (PersonList?)(await personListPortal.FetchAsync()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Csla" />
<PackageReference Include="Csla.Generator.AutoImplementProperties.CSharp" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public CheckCase(Csla.Core.IPropertyInfo primaryProperty)

protected override void Execute(IRuleContext context)
{
var text = (string)ReadProperty(context.Target, PrimaryProperty);
var text = (string?)ReadProperty(context.Target!, PrimaryProperty!);
if (string.IsNullOrWhiteSpace(text)) return;
var ideal = text.Substring(0, 1).ToUpper();
ideal += text.Substring(1).ToLower();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public LetterCount(Csla.Core.IPropertyInfo primaryProperty, Csla.Core.IPropertyI

protected override void Execute(IRuleContext context)
{
var text = (string)ReadProperty(context.Target, PrimaryProperty);
var count = text.Length;
var text = (string?)ReadProperty(context.Target!, PrimaryProperty!);
var count = text?.Length ?? 0;
context.AddOutValue(AffectedProperties[1], count);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public NoZAllowed(Csla.Core.IPropertyInfo primaryProperty)

protected override void Execute(IRuleContext context)
{
var text = (string)ReadProperty(context.Target, PrimaryProperty);
if (text.ToLower().Contains("z"))
var text = (string?)ReadProperty(context.Target!, PrimaryProperty!);
if (text?.ToLower().Contains("z") ?? false)
context.AddErrorResult("No letter Z allowed");
}
}
Expand Down
70 changes: 23 additions & 47 deletions Samples/BlazorExample/BlazorExample/BusinessLibrary/PersonEdit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,15 @@

namespace BusinessLibrary
{
[Serializable]
public class PersonEdit : BusinessBase<PersonEdit>
[CslaImplementProperties]
public partial class PersonEdit : BusinessBase<PersonEdit>
{
public static readonly PropertyInfo<int> IdProperty = RegisterProperty<int>(nameof(Id));
public int Id
{
get { return GetProperty(IdProperty); }
set { SetProperty(IdProperty, value); }
}
public partial int Id { get; private set; }

public static readonly PropertyInfo<string> NameProperty = RegisterProperty<string>(nameof(Name));
[Required]
public string Name
{
get { return GetProperty(NameProperty); }
set { SetProperty(NameProperty, value); }
}
public partial string? Name { get; set; }

public static readonly PropertyInfo<int> NameLengthProperty = RegisterProperty<int>(nameof(NameLength));
public int NameLength
{
get => GetProperty(NameLengthProperty);
set => SetProperty(NameLengthProperty, value);
}
public partial int NameLength { get; private set; }

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
[ObjectAuthorizationRules]
Expand All @@ -53,58 +38,49 @@ protected override void AddBusinessRules()
[Create]
private void Create()
{
Id = -1;
base.Child_Create();
LoadProperty(IdProperty, -1);
}

[Fetch]
private void Fetch(int id, [Inject]DataAccess.IPersonDal dal)
private void Fetch(int id, [Inject] DataAccess.IPersonDal dal)
{
var data = dal.Get(id);
using (BypassPropertyChecks)
Csla.Data.DataMapper.Map(data, this);
Csla.Data.DataMapper.Map(data, this);
BusinessRules.CheckRules();
}

[Insert]
private void Insert([Inject]DataAccess.IPersonDal dal)
private void Insert([Inject] DataAccess.IPersonDal dal)
{
using (BypassPropertyChecks)
var data = new DataAccess.PersonEntity
{
var data = new DataAccess.PersonEntity
{
Name = Name
};
var result = dal.Insert(data);
Id = result.Id;
}
Name = Name
};
var result = dal.Insert(data);
LoadProperty(IdProperty, result.Id);
}

[Update]
private void Update([Inject]DataAccess.IPersonDal dal)
private void Update([Inject] DataAccess.IPersonDal dal)
{
using (BypassPropertyChecks)
var data = new DataAccess.PersonEntity
{
var data = new DataAccess.PersonEntity
{
Id = Id,
Name = Name
};
dal.Update(data);
}
Id = Id,
Name = Name
};
dal.Update(data);
}

[DeleteSelf]
private void DeleteSelf([Inject]DataAccess.IPersonDal dal)
private void DeleteSelf([Inject] DataAccess.IPersonDal dal)
{
Delete(ReadProperty(IdProperty), dal);
Delete(Id, dal);
}

[Delete]
private void Delete(int id, [Inject]DataAccess.IPersonDal dal)
private void Delete(int id, [Inject] DataAccess.IPersonDal dal)
{
dal.Delete(id);
}

}
}
22 changes: 6 additions & 16 deletions Samples/BlazorExample/BlazorExample/BusinessLibrary/PersonInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,18 @@

namespace BusinessLibrary
{
[Serializable]
public class PersonInfo : ReadOnlyBase<PersonInfo>
[CslaImplementProperties]
public partial class PersonInfo : ReadOnlyBase<PersonInfo>
{
public static readonly PropertyInfo<int> IdProperty = RegisterProperty<int>(nameof(Id));
public int Id
{
get { return GetProperty(IdProperty); }
private set { LoadProperty(IdProperty, value); }
}
public partial int Id { get; private set; }

public static readonly PropertyInfo<string> NameProperty = RegisterProperty<string>(nameof(Name));
public string Name
{
get { return GetProperty(NameProperty); }
private set { LoadProperty(NameProperty, value); }
}
public partial string? Name { get; private set; }

[FetchChild]
private void Fetch(DataAccess.PersonEntity data)
{
Id = data.Id;
Name = data.Name;
LoadProperty(IdProperty, data.Id);
LoadProperty(NameProperty, data.Name);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>DataAccess.Mock</AssemblyName>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ namespace DataAccess
public class PersonEntity
{
public int Id { get; set; }
public string Name { get; set; }
public string? Name { get; set; }
}
}
11 changes: 6 additions & 5 deletions Samples/BlazorExample/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CslaVersion>9.0.0-alpha-g27c299cae5</CslaVersion>
<CslaVersion>10.0.0-alpha-0009-g2abd6121c5</CslaVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Csla" Version="9.0.0-rc4-gc005a93a3c" />
<PackageVersion Include="Csla.AspNetCore" Version="9.0.0-rc4-gc005a93a3c" />
<PackageVersion Include="Csla.Blazor" Version="9.0.0-rc4-gc005a93a3c" />
<PackageVersion Include="Csla.Blazor.WebAssembly" Version="9.0.0-rc4-gc005a93a3c" />
<PackageVersion Include="Csla" Version="$(CslaVersion)" />
<PackageVersion Include="Csla.AspNetCore" Version="$(CslaVersion)" />
<PackageVersion Include="Csla.Blazor" Version="$(CslaVersion)" />
<PackageVersion Include="Csla.Blazor.WebAssembly" Version="$(CslaVersion)" />
<PackageVersion Include="Csla.Generator.AutoImplementProperties.CSharp" Version="$(CslaVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<!-- Add these properties for correct NuGet consumption -->
<IsPackable>true</IsPackable>
<DevelopmentDependency>true</DevelopmentDependency>
<DevelopmentDependency>false</DevelopmentDependency>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<!-- Add these properties for correct NuGet consumption -->
<IsPackable>true</IsPackable>
<DevelopmentDependency>true</DevelopmentDependency>
<DevelopmentDependency>false</DevelopmentDependency>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
</PropertyGroup>
<ItemGroup>
Expand Down
8 changes: 7 additions & 1 deletion Source/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

<!-- Common Package Settings -->
<PropertyGroup>
<Version>10.0.0.0</Version>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://cslanet.com</PackageProjectUrl>
<RepositoryUrl>https://github.com/MarimerLLC/csla</RepositoryUrl>
Expand All @@ -24,4 +23,11 @@
<DefaultLanguage>en-US</DefaultLanguage>
<AssemblyOriginatorKeyFile>$(SolutionDir)Csla\CslaKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
<PrivateAssets>all</PrivateAssets>
<Version>3.8.118</Version>
</PackageReference>
</ItemGroup>
</Project>
27 changes: 0 additions & 27 deletions Source/Directory.Package.props
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
<Project>

<!-- Read version from version.json -->
<Target Name="ReadVersionFromJson" BeforeTargets="Build;Pack">
<ReadLinesFromFile File="$(MSBuildThisFileDirectory)version.json">
<Output TaskParameter="Lines" ItemName="VersionJsonLines" />
</ReadLinesFromFile>
<PropertyGroup>
<VersionJsonContent>@(VersionJsonLines)</VersionJsonContent>
<PackageVersionFromJson>$([System.Text.RegularExpressions.Regex]::Match($(VersionJsonContent), '"version"\s*:\s*"([^"]+)"').Groups[1].Value)</PackageVersionFromJson>
</PropertyGroup>
</Target>

<!-- Common Package Settings -->
<PropertyGroup>
<PackageVersion>$(PackageVersionFromJson)</PackageVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://cslanet.com</PackageProjectUrl>
<OutputPath>..\..\bin\packages\</OutputPath>
Expand All @@ -37,20 +24,6 @@
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.7.115">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<!-- Override Nerdbank.GitVersioning package version after it's calculated -->
<Target Name="OverrideNerdBankPackageVersion" BeforeTargets="GenerateNuspec">
<PropertyGroup>
<PackageVersion>$(PackageVersionFromJson)</PackageVersion>
</PropertyGroup>
</Target>

<ItemGroup Condition="'$(IsPackable)'=='true' AND '$(PackageIcon)'!=''">
<None Include="$(MSBuildThisFileDirectory)..\Source\readme.md" Pack="true" PackagePath="\" />
<None Include="$(MSBuildThisFileDirectory)..\Support\Logos\csla.png" Link="csla.png" Pack="true" PackagePath="\images\csla.png" Visible="false" />
Expand Down
2 changes: 0 additions & 2 deletions Source/tests/Csla.Analyzers.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
[assembly: AssemblyTitle("Csla.Analyzers")]
[assembly: AssemblyProduct("Csla.Analyzers")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
12 changes: 0 additions & 12 deletions Source/tests/Csla.test/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,3 @@

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c83f79e5-ed07-4c9e-b436-217b5eb03d65")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.5.30.0")]
[assembly: AssemblyFileVersion("4.5.30.0")]
2 changes: 1 addition & 1 deletion Source/tests/Csla.test/Serialization/SerializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ public void TestSerializationNames()
Assert.AreEqual("Csla.ApplicationContext, /c", AssemblyNameTranslator.GetSerializationName(typeof(ApplicationContext), false));
Assert.AreEqual("Csla.ApplicationContext, /c", AssemblyNameTranslator.GetSerializationName(typeof(ApplicationContext), true));
Assert.AreEqual("Csla.Test.Serialization.BinaryReaderWriterTestClass, Csla.Tests", AssemblyNameTranslator.GetSerializationName(typeof(BinaryReaderWriterTestClass), false));
Assert.AreEqual("Csla.Test.Serialization.BinaryReaderWriterTestClass, Csla.Tests, Version=4.5.30.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30", AssemblyNameTranslator.GetSerializationName(typeof(BinaryReaderWriterTestClass), true));
Assert.AreEqual("Csla.Test.Serialization.BinaryReaderWriterTestClass, Csla.Tests, Version=10.0.0.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30", AssemblyNameTranslator.GetSerializationName(typeof(BinaryReaderWriterTestClass), true));
}

// TODO: fix test
Expand Down
Loading
Loading