Skip to content

Commit

Permalink
Merge pull request #246 from Flexberry/fix-232024-remove-designer-bugs
Browse files Browse the repository at this point in the history
Исправление редкой ошибки с нехранимыми свойствами и наследованием
  • Loading branch information
Anisimova2020 authored Apr 17, 2023
2 parents 0ed5a66 + dde391c commit fa8b0e4
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Removed

### Fixed
1. Error on loading with not stored attribute with inheritance.

### Security

Expand Down
11 changes: 8 additions & 3 deletions ICSSoft.STORMNET.DataObject/Information.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public static void SetPropValueByName(DataObject obj, string propName, string Pr
propType = Nullable.GetUnderlyingType(propType);
}

SetHandler setHandler = GetSetHandler(tp, pi);
SetHandler setHandler = GetSetHandler(tp, pi, true);

if (propType == typeof(string))
{
Expand Down Expand Up @@ -467,8 +467,9 @@ private static bool IsSystemType(System.Type type)
/// </summary>
/// <param name="type">Тип данных.</param>
/// <param name="propInfo">Метаданные о свойстве.</param>
/// <param name="piCheck">Флаг, определяющий, что следует производить проверку возможности создания <see cref="SetHandler"/> перед созданием.</param>
/// <returns>Делегат.</returns>
internal static SetHandler GetSetHandler(Type type, PropertyInfo propInfo)
internal static SetHandler GetSetHandler(Type type, PropertyInfo propInfo, bool piCheck = false)
{
if (type == null)
{
Expand All @@ -481,7 +482,11 @@ internal static SetHandler GetSetHandler(Type type, PropertyInfo propInfo)
}

long key = (type.GetHashCode() * 10000000000) + propInfo.Name.GetHashCode();
return cacheSetPropValueByName.GetOrAdd(key, k => DynamicMethodCompiler.CreateSetHandler(type, propInfo));
return cacheSetPropValueByName.GetOrAdd(
key,
k => {
return (!piCheck || propInfo.CanWrite) ? DynamicMethodCompiler.CreateSetHandler(type, propInfo) : null;
});
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,30 @@ public void TestLoadingNotStoredProperty()
}
}
}

/// <summary>
/// Выполняется тестирование работы с нехранимым классом при наследовании.
/// </summary>
[Fact]
public void NotStoredTest()
{
foreach (IDataService dataService in DataServices)
{
Tests.Cabbage2 cabbage = new Tests.Cabbage2 { Name = "Test" + DateTime.Now.ToString() };
var objsToUpdate = new DataObject[] { cabbage };
dataService.UpdateObjects(ref objsToUpdate, new DataObjectCache(), true);
View view = new View()
{
DefineClassType = typeof(Tests.Cabbage2),
Properties = new PropertyInView[] { new PropertyInView("AssocType", string.Empty, true, string.Empty) },
};
LoadingCustomizationStruct lcs = LoadingCustomizationStruct.GetSimpleStruct(typeof(Tests.Cabbage2), view);
int count;

DataObject[] result = dataService.LoadObjects(lcs);
Assert.NotNull(result);
Assert.Equal(1, result.Length);
}
}
}
}
10 changes: 5 additions & 5 deletions NewPlatform.Flexberry.ORM.MSSQLDataService.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>NewPlatform.Flexberry.ORM.MSSQLDataService</id>
<version>7.1.0</version>
<version>7.1.1-beta01</version>
<title>Flexberry ORM</title>
<authors>New Platform Ltd</authors>
<owners>New Platform Ltd</owners>
Expand All @@ -12,17 +12,17 @@
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>Flexberry ORM package.</description>
<releaseNotes>
Added
1. Add asyncronous DataService interface.
Changed
1. Updated NewPlatform.Flexberry.ORM up to 7.1.1-beta01.
</releaseNotes>
<copyright>Copyright New Platform Ltd 2023</copyright>
<tags>Flexberry ORM</tags>
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="NewPlatform.Flexberry.ORM" version="7.1.0" />
<dependency id="NewPlatform.Flexberry.ORM" version="7.1.1-beta01" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="NewPlatform.Flexberry.ORM" version="7.1.0" />
<dependency id="NewPlatform.Flexberry.ORM" version="7.1.1-beta01" />
<dependency id="System.Data.SqlClient" version="4.6.1" />
</group>
</dependencies>
Expand Down
10 changes: 5 additions & 5 deletions NewPlatform.Flexberry.ORM.OracleDataService.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>NewPlatform.Flexberry.ORM.OracleDataService</id>
<version>7.1.0</version>
<version>7.1.1-beta01</version>
<title>Flexberry ORM</title>
<authors>New Platform Ltd</authors>
<owners>New Platform Ltd</owners>
Expand All @@ -12,18 +12,18 @@
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>Flexberry ORM package.</description>
<releaseNotes>
Added
1. Add asyncronous DataService interface.
Changed
1. Updated NewPlatform.Flexberry.ORM up to 7.1.1-beta01.
</releaseNotes>
<copyright>Copyright New Platform Ltd 2023</copyright>
<tags>Flexberry ORM</tags>
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="NewPlatform.Flexberry.ORM" version="7.1.0" />
<dependency id="NewPlatform.Flexberry.ORM" version="7.1.1-beta01" />
<dependency id="Oracle.ManagedDataAccess" version="12.1.22" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="NewPlatform.Flexberry.ORM" version="7.1.0" />
<dependency id="NewPlatform.Flexberry.ORM" version="7.1.1-beta01" />
<dependency id="Oracle.ManagedDataAccess.Core" version="2.19.3" />
</group>
</dependencies>
Expand Down
11 changes: 4 additions & 7 deletions NewPlatform.Flexberry.ORM.PostgresDataService.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>NewPlatform.Flexberry.ORM.PostgresDataService</id>
<version>7.1.0</version>
<version>7.1.1-beta01</version>
<title>Flexberry ORM</title>
<authors>New Platform Ltd</authors>
<owners>New Platform Ltd</owners>
Expand All @@ -12,16 +12,13 @@
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>Flexberry ORM package.</description>
<releaseNotes>
Added
1. Add asyncronous DataService interface.

Changed
1. Upgraded Npgsql version to 3.2.7 (PostgreSQL 14+ support).
Changed
1. Updated NewPlatform.Flexberry.ORM up to 7.1.1-beta01.
</releaseNotes>
<copyright>Copyright New Platform Ltd 2023</copyright>
<tags>Flexberry ORM</tags>
<dependencies>
<dependency id="NewPlatform.Flexberry.ORM" version="7.1.0" />
<dependency id="NewPlatform.Flexberry.ORM" version="7.1.1-beta01" />
<dependency id="Npgsql" version="3.2.7" />
</dependencies>
</metadata>
Expand Down
14 changes: 12 additions & 2 deletions NewPlatform.Flexberry.ORM.Test.Objects/Cabbage2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,22 @@ public class Cabbage2 : NewPlatform.Flexberry.ORM.Tests.Plant2
private string fType;

private NewPlatform.Flexberry.ORM.Tests.DetailArrayOfCabbagePart2 fCabbageParts;

// *** Start programmer edit section *** (Cabbage2 CustomMembers)

[NotStored]
[DataServiceExpression(typeof(ICSSoft.STORMNET.Business.PostgresDataService), "'Association'")]
public override string AssocType
{
get
{
return base.AssocType;
}
}

// *** End programmer edit section *** (Cabbage2 CustomMembers)


/// <summary>
/// Type.
/// </summary>
Expand Down
13 changes: 11 additions & 2 deletions NewPlatform.Flexberry.ORM.Test.Objects/Plant2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,21 @@ public class Plant2 : ICSSoft.STORMNET.DataObject, ICSSoft.STORMNET.Business.Int
{

private string fName;

// *** Start programmer edit section *** (Plant2 CustomMembers)

[NotStored]
public virtual string AssocType
{
get
{
return GetType().Name;
}
}

// *** End programmer edit section *** (Plant2 CustomMembers)


/// <summary>
/// Name.
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions NewPlatform.Flexberry.ORM.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>NewPlatform.Flexberry.ORM</id>
<version>7.1.0</version>
<version>7.1.1-beta01</version>
<title>Flexberry ORM</title>
<authors>New Platform Ltd</authors>
<owners>New Platform Ltd</owners>
Expand All @@ -12,8 +12,8 @@
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>Flexberry ORM package.</description>
<releaseNotes>
Added
1. Add asyncronous DataService interface.
Fixed
1. Error on loading with not stored attribute with inheritance.
</releaseNotes>
<copyright>Copyright New Platform Ltd 2023</copyright>
<tags>Flexberry ORM</tags>
Expand Down

0 comments on commit fa8b0e4

Please sign in to comment.