Update samples to net7 (#350)
This commit is contained in:
Родитель
b6e2b3c90e
Коммит
359b753f8f
|
@ -14,6 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Samples.IndexedVectors;
|
||||
|
||||
/// <summary>
|
||||
|
@ -44,11 +46,11 @@ public class IndexedVectorsExample : IFlatSharpSample
|
|||
{
|
||||
Users = new IndexedVector<string, User>
|
||||
{
|
||||
{ new User("1") { FirstName = "Charlie", LastName = "Kelly" } },
|
||||
{ new User("2") { FirstName = "Dennis", LastName = "Reynolds" } },
|
||||
{ new User("3") { FirstName = "Ronald", LastName = "McDonald" } },
|
||||
{ new User("4") { FirstName = "Frank", LastName = "Reynolds" } },
|
||||
{ new User("5") { FirstName = "Deeandra", LastName = "Reynolds" } },
|
||||
{ new User { Id = "1", FirstName = "Charlie", LastName = "Kelly" } },
|
||||
{ new User { Id = "2", FirstName = "Dennis", LastName = "Reynolds" } },
|
||||
{ new User { Id = "3", FirstName = "Ronald", LastName = "McDonald" } },
|
||||
{ new User { Id = "4", FirstName = "Frank", LastName = "Reynolds" } },
|
||||
{ new User { Id = "5", FirstName = "Deeandra", LastName = "Reynolds" } },
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -79,14 +81,3 @@ public class IndexedVectorsExample : IFlatSharpSample
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Define a partial class for user to expose a public constructor that correctly initializes the object.
|
||||
/// </summary>
|
||||
public partial class User
|
||||
{
|
||||
public User(string id)
|
||||
{
|
||||
this.Id = id;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,9 @@ table IndexedVectorTable (fs_serializer:"Progressive")
|
|||
Users : [ User ] (fs_vector:"IIndexedVector");
|
||||
}
|
||||
|
||||
// We tell Flatsharp not to generate a parameterless constructor for this type.
|
||||
// In the corresponding C#, we define a constructor that requires an ID.
|
||||
table User (fs_defaultCtor:"None")
|
||||
// If using something before .NET 7, consider using fs_defaultCtor:"None" on the table
|
||||
// so you can define a constructor that forces Id to be defined.
|
||||
table User
|
||||
{
|
||||
id : string (key, required, fs_setter:"PublicInit");
|
||||
first_name : string;
|
||||
|
|
|
@ -53,6 +53,8 @@ public class StructVectorsSample : IFlatSharpSample
|
|||
Sender = "5566779900",
|
||||
|
||||
HashReference = new Sha256_Reference(),
|
||||
HashValue = new Sha256_Value(),
|
||||
HashFastValue = new Sha256_FastValue(),
|
||||
};
|
||||
|
||||
byte[] originalHash;
|
||||
|
|
|
@ -59,7 +59,10 @@ public class WriteThroughSample : IFlatSharpSample
|
|||
|
||||
{
|
||||
// Each block is 128 bytes. For a 1MB filter, we need 8192 blocks.
|
||||
BloomFilter filter = new BloomFilter(1024 * 1024 / 128);
|
||||
BloomFilter filter = new BloomFilter(1024 * 1024 / 128)
|
||||
{
|
||||
Blocks = new List<Block>()
|
||||
};
|
||||
|
||||
// Write our bloom filter out to an array. It should be about 1MB in size.
|
||||
rawData = new byte[BloomFilter.Serializer.GetMaxSize(filter)];
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<OutputType>exe</OutputType>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
<LangVersion>11.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<!-- Necessary only for the unsafe example. -->
|
||||
|
@ -31,11 +31,11 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FlatSharp.Compiler" Version="7.0.0">
|
||||
<PackageReference Include="FlatSharp.Compiler" Version="7.0.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="FlatSharp.Runtime" Version="7.0.0" />
|
||||
<PackageReference Include="FlatSharp.Runtime" Version="7.0.1" />
|
||||
<PackageReference Include="Grpc" Version="2.38.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
Загрузка…
Ссылка в новой задаче