Closed rockfordlhotka closed 3 months ago
Can you copy the class here?
Can you copy the class here?
I did the following:
main
BusinessLibrary
projectProjectEdit
classFailure occurs.
I changed the ProjectEdit.cs like this
[Serializable]
[CslaImplementPropertiesInterface<IProjectEdit>]
public partial class ProjectEdit : CslaBaseTypes.BusinessBase<ProjectEdit>
{
private interface IProjectEdit
{
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public byte[] TimeStamp
{
get;
set;
}
[Display(Name = "Project id")]
public int Id
{
get;
}
[Display(Name = "Project name")]
[Required]
[StringLength(50)]
public string Name
{
get;
set;
}
public DateTime? Started
{
get;
set;
}
public DateTime? Ended
{
get;
set;
}
public string Description
{
get;
set;
}
public ProjectResources Resources
{
get;
}
}
and update the generator to implement like this
//<auto-generated/>
using System;
using Csla;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace ProjectTracker.Library;
public partial class ProjectEdit
{
public static readonly PropertyInfo<byte[]> TimeStampProperty = RegisterProperty<byte[]>(nameof(TimeStamp));
[System.ComponentModel.Browsable(false )]
[System.ComponentModel.EditorBrowsable(EditorBrowsableState.Never )]
public byte[] TimeStamp
{
get => GetProperty(TimeStampProperty);
set => SetProperty(TimeStampProperty, value);
}
public static readonly PropertyInfo<int> IdProperty = RegisterProperty<int>(nameof(Id));
[System.ComponentModel.DataAnnotations.Display( Name="Project id")]
public int Id
{
get => GetProperty(IdProperty);
private set => SetProperty(IdProperty, value);
}
public static readonly PropertyInfo<string> NameProperty = RegisterProperty<string>(nameof(Name));
[System.ComponentModel.DataAnnotations.Display( Name="Project name")]
[System.ComponentModel.DataAnnotations.Required( )]
[System.ComponentModel.DataAnnotations.StringLength(50 )]
public string Name
{
get => GetProperty(NameProperty);
set => SetProperty(NameProperty, value);
}
public static readonly PropertyInfo<DateTime?> StartedProperty = RegisterProperty<DateTime?>(nameof(Started));
public DateTime? Started
{
get => GetProperty(StartedProperty);
set => SetProperty(StartedProperty, value);
}
public static readonly PropertyInfo<DateTime?> EndedProperty = RegisterProperty<DateTime?>(nameof(Ended));
public DateTime? Ended
{
get => GetProperty(EndedProperty);
set => SetProperty(EndedProperty, value);
}
public static readonly PropertyInfo<string> DescriptionProperty = RegisterProperty<string>(nameof(Description));
public string Description
{
get => GetProperty(DescriptionProperty);
set => SetProperty(DescriptionProperty, value);
}
public static readonly PropertyInfo<ProjectResources> ResourcesProperty = RegisterProperty<ProjectResources>(nameof(Resources));
public ProjectResources Resources
{
get => GetProperty(ResourcesProperty);
private set => SetProperty(ResourcesProperty, value);
}
}
and updated the tests
@luizfbicalho that should fix the non-interface scenario as well? I was using .NET 9 and the latest C#, so didn't use the interface approach.
I expect that, because it's a shared code that I changed
Edit:
I validated the other generator, the result is correct too
Describe the bug I tried using
CslaImplementProperties
in the ProjectTracker sample and it didn't work as expected. I wonder if the issue is because there is a custom base class betweenCsla.BusinessBase
and the business class?The issue appears to be that the generator creates an extra
using
like this:Version and Platform CSLA version: 9