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
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# EF Core 4.1.0
Comment thread
Daniel-Svensson marked this conversation as resolved.

* Generate `[Required(AllowEmptyStrings=true)]` instead of `[Required]` on client for non nullable string properties

# 5.8.0

This release gives some ❤️ to AvaloniaUI and other frameworks which use IList for data binding.
Expand Down
13 changes: 7 additions & 6 deletions src/OpenRiaServices.Client/Framework/InvokeResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ namespace OpenRiaServices.Client
/// </summary>
interface IInvokeResult
{
/// <summary>
/// Get the value returned by the Invoke operation, if any. If the Invoke operation does not return a value, this will be null.
/// </summary>
object? Value { get; }
}

Expand All @@ -27,15 +30,13 @@ public class InvokeResult : IInvokeResult
/// </summary>
public class InvokeResult<T> : InvokeResult, IInvokeResult
{
private readonly T _value;

/// <summary>
/// Initializes a new instance of the <see cref="InvokeResult{T}"/> class.
/// </summary>
/// <param name="value">The value.</param>
public InvokeResult(T value)
{
_value = value;
Value = value;
}

/// <summary>
Expand All @@ -44,16 +45,16 @@ public InvokeResult(T value)
/// <value>
/// The value.
/// </value>
public T? Value => _value;
public T Value { get; }

object? IInvokeResult.Value => _value;
object? IInvokeResult.Value => Value;

/// <summary>
/// Implicit conversion to <typeparamref name="T"/> so that <see cref="Value"/> does not need to be used
/// in most cases.
/// </summary>
/// <param name="invokeResult"></param>
public static implicit operator T?(InvokeResult<T> invokeResult)
public static implicit operator T(InvokeResult<T> invokeResult)
{
return invokeResult.Value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ protected override IEnumerable<Attribute> GetMemberAttributes(PropertyDescriptor
&& !databaseGenerated
&& pd.Attributes[typeof(RequiredAttribute)] == null)
{
attributes.Add(new RequiredAttribute());
attributes.Add(new RequiredAttribute() { AllowEmptyStrings = (property.ClrType == typeof(string)) });
}

bool isStringType = pd.PropertyType == typeof(string) || pd.PropertyType == typeof(char[]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<TargetFrameworks>net472;net8.0;net10.0</TargetFrameworks>
<DefineConstants>$(DefineConstants);SERVERFX;EFCORE</DefineConstants>
<GeneratePackageOnBuild Condition="'$(Configuration)'=='Release'">true</GeneratePackageOnBuild>
<VersionPrefix>4.0.0</VersionPrefix>
<AssemblyVersion>4.0.0</AssemblyVersion>
<VersionPrefix>4.1.0</VersionPrefix>
<AssemblyVersion>4.1.0</AssemblyVersion>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression></PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public int CategoryID
/// Gets or sets the 'CategoryName' value.
/// </summary>
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
[StringLength(15)]
public string CategoryName
{
Expand Down Expand Up @@ -339,7 +339,7 @@ public string City
/// </summary>
[ConcurrencyCheck()]
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
[RoundtripOriginal()]
[StringLength(40)]
public string CompanyName
Expand Down Expand Up @@ -450,7 +450,7 @@ public string Country
[DataMember()]
[Editable(false, AllowInitialValue=true)]
[Key()]
[Required()]
[Required(AllowEmptyStrings=true)]
[RoundtripOriginal()]
[StringLength(15)]
public string CustomerID
Expand Down Expand Up @@ -1736,7 +1736,7 @@ public int ProductID
/// </summary>
[ConcurrencyCheck()]
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
[RoundtripOriginal()]
[StringLength(40)]
public string ProductName
Expand Down Expand Up @@ -2219,7 +2219,7 @@ public Region()
/// Gets or sets the 'RegionDescription' value.
/// </summary>
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
[StringLength(50)]
public string RegionDescription
{
Expand Down Expand Up @@ -2421,7 +2421,7 @@ public int RegionID
/// Gets or sets the 'TerritoryDescription' value.
/// </summary>
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
[StringLength(50)]
public string TerritoryDescription
{
Expand Down Expand Up @@ -2449,7 +2449,7 @@ public string TerritoryDescription
[DataMember()]
[Editable(false, AllowInitialValue=true)]
[Key()]
[Required()]
[Required(AllowEmptyStrings=true)]
[RoundtripOriginal()]
[StringLength(20)]
public string TerritoryID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Namespace EFCoreModels.Northwind
''' Gets or sets the 'CategoryName' value.
''' </summary>
<DataMember(), _
Required(), _
Required(AllowEmptyStrings:=true), _
StringLength(15)> _
Public Property CategoryName() As String
Get
Expand Down Expand Up @@ -346,7 +346,7 @@ Namespace EFCoreModels.Northwind
''' </summary>
<ConcurrencyCheck(), _
DataMember(), _
Required(), _
Required(AllowEmptyStrings:=true), _
RoundtripOriginal(), _
StringLength(40)> _
Public Property CompanyName() As String
Expand Down Expand Up @@ -441,7 +441,7 @@ Namespace EFCoreModels.Northwind
DataMember(), _
Editable(false, AllowInitialValue:=true), _
Key(), _
Required(), _
Required(AllowEmptyStrings:=true), _
RoundtripOriginal(), _
StringLength(15)> _
Public Property CustomerID() As String
Expand Down Expand Up @@ -1629,7 +1629,7 @@ Namespace EFCoreModels.Northwind
''' </summary>
<ConcurrencyCheck(), _
DataMember(), _
Required(), _
Required(AllowEmptyStrings:=true), _
RoundtripOriginal(), _
StringLength(40)> _
Public Property ProductName() As String
Expand Down Expand Up @@ -2064,7 +2064,7 @@ Namespace EFCoreModels.Northwind
''' Gets or sets the 'RegionDescription' value.
''' </summary>
<DataMember(), _
Required(), _
Required(AllowEmptyStrings:=true), _
StringLength(50)> _
Public Property RegionDescription() As String
Get
Expand Down Expand Up @@ -2246,7 +2246,7 @@ Namespace EFCoreModels.Northwind
''' Gets or sets the 'TerritoryDescription' value.
''' </summary>
<DataMember(), _
Required(), _
Required(AllowEmptyStrings:=true), _
StringLength(50)> _
Public Property TerritoryDescription() As String
Get
Expand All @@ -2270,7 +2270,7 @@ Namespace EFCoreModels.Northwind
<DataMember(), _
Editable(false, AllowInitialValue:=true), _
Key(), _
Required(), _
Required(AllowEmptyStrings:=true), _
RoundtripOriginal(), _
StringLength(20)> _
Public Property TerritoryID() As String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public int CategoryID
/// Gets or sets the 'CategoryName' value.
/// </summary>
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
[StringLength(15)]
public string CategoryName
{
Expand Down Expand Up @@ -339,7 +339,7 @@ public string City
/// </summary>
[ConcurrencyCheck()]
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
[RoundtripOriginal()]
[StringLength(40)]
public string CompanyName
Expand Down Expand Up @@ -450,7 +450,7 @@ public string Country
[DataMember()]
[Editable(false, AllowInitialValue=true)]
[Key()]
[Required()]
[Required(AllowEmptyStrings=true)]
[RoundtripOriginal()]
[StringLength(15)]
public string CustomerID
Expand Down Expand Up @@ -1736,7 +1736,7 @@ public int ProductID
/// </summary>
[ConcurrencyCheck()]
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
[RoundtripOriginal()]
[StringLength(40)]
public string ProductName
Expand Down Expand Up @@ -2219,7 +2219,7 @@ public Region()
/// Gets or sets the 'RegionDescription' value.
/// </summary>
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
[StringLength(50)]
public string RegionDescription
{
Expand Down Expand Up @@ -2421,7 +2421,7 @@ public int RegionID
/// Gets or sets the 'TerritoryDescription' value.
/// </summary>
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
[StringLength(50)]
public string TerritoryDescription
{
Expand Down Expand Up @@ -2449,7 +2449,7 @@ public string TerritoryDescription
[DataMember()]
[Editable(false, AllowInitialValue=true)]
[Key()]
[Required()]
[Required(AllowEmptyStrings=true)]
[RoundtripOriginal()]
[StringLength(20)]
public string TerritoryID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Namespace EFCoreModels.Northwind
''' Gets or sets the 'CategoryName' value.
''' </summary>
<DataMember(), _
Required(), _
Required(AllowEmptyStrings:=true), _
StringLength(15)> _
Public Property CategoryName() As String
Get
Expand Down Expand Up @@ -346,7 +346,7 @@ Namespace EFCoreModels.Northwind
''' </summary>
<ConcurrencyCheck(), _
DataMember(), _
Required(), _
Required(AllowEmptyStrings:=true), _
RoundtripOriginal(), _
StringLength(40)> _
Public Property CompanyName() As String
Expand Down Expand Up @@ -441,7 +441,7 @@ Namespace EFCoreModels.Northwind
DataMember(), _
Editable(false, AllowInitialValue:=true), _
Key(), _
Required(), _
Required(AllowEmptyStrings:=true), _
RoundtripOriginal(), _
StringLength(15)> _
Public Property CustomerID() As String
Expand Down Expand Up @@ -1629,7 +1629,7 @@ Namespace EFCoreModels.Northwind
''' </summary>
<ConcurrencyCheck(), _
DataMember(), _
Required(), _
Required(AllowEmptyStrings:=true), _
RoundtripOriginal(), _
StringLength(40)> _
Public Property ProductName() As String
Expand Down Expand Up @@ -2064,7 +2064,7 @@ Namespace EFCoreModels.Northwind
''' Gets or sets the 'RegionDescription' value.
''' </summary>
<DataMember(), _
Required(), _
Required(AllowEmptyStrings:=true), _
StringLength(50)> _
Public Property RegionDescription() As String
Get
Expand Down Expand Up @@ -2246,7 +2246,7 @@ Namespace EFCoreModels.Northwind
''' Gets or sets the 'TerritoryDescription' value.
''' </summary>
<DataMember(), _
Required(), _
Required(AllowEmptyStrings:=true), _
StringLength(50)> _
Public Property TerritoryDescription() As String
Get
Expand All @@ -2270,7 +2270,7 @@ Namespace EFCoreModels.Northwind
<DataMember(), _
Editable(false, AllowInitialValue:=true), _
Key(), _
Required(), _
Required(AllowEmptyStrings:=true), _
RoundtripOriginal(), _
StringLength(20)> _
Public Property TerritoryID() As String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public Address()
/// Gets or sets the 'AddressLine' value.
/// </summary>
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
[StringLength(100)]
public string AddressLine
{
Expand All @@ -85,7 +85,7 @@ public string AddressLine
/// Gets or sets the 'City' value.
/// </summary>
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
[StringLength(50)]
public string City
{
Expand Down Expand Up @@ -171,7 +171,7 @@ public Address Address
/// Gets or sets the 'HomePhone' value.
/// </summary>
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
[StringLength(24)]
public string HomePhone
{
Expand Down Expand Up @@ -421,7 +421,7 @@ public OwnedEntityWithBackNavigation()
/// Gets or sets the 'Description' value.
/// </summary>
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
public string Description
{
get
Expand Down Expand Up @@ -481,7 +481,7 @@ public OwnedEntityWithExplicitId()
/// Gets or sets the 'Description' value.
/// </summary>
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
public string Description
{
get
Expand Down Expand Up @@ -578,7 +578,7 @@ public OwnedEntityWithExplicitIdAndBackNavigation()
/// Gets or sets the 'Description' value.
/// </summary>
[DataMember()]
[Required()]
[Required(AllowEmptyStrings=true)]
public string Description
{
get
Expand Down
Loading
Loading