Skip to content

(#341) Updates to sample Nugets #356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 18, 2025
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
8 changes: 4 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
<PackageVersion Include="FluentAssertions.Web" Version="1.8.0" />
<PackageVersion Include="LiteDB" Version="5.0.21" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.4" />
<PackageVersion Include="Microsoft.AspNetCore.OData" Version="9.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.OData" Version="9.3.1" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="9.0.4" />
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.49.0" />
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.51.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.4" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Cosmos" Version="9.0.4" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.4" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Proxies" Version="9.0.4" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.4" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.5" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.4" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.5" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageVersion Include="Microsoft.OData.Core" Version="8.2.3" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/client/part-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,4 @@ In the [next tutorial](./part-2.md), I'm going to talk about authenticating clie
[todomvc]: https://github.com/CommunityToolkit/Datasync/tree/main/samples/todoapp-mvc
[todoapp]: https://github.com/CommunityToolkit/Datasync/tree/main/samples/todoapp-tutorial
[CommunityToolkit.MVVM]: https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mvvm/
[CommunityToolkit.Datasync.Client]: https://www.nuget.org/packages/CommunityToolkit.Datasync.Client#readme-body-tab
[CommunityToolkit.Datasync.Client]: https://www.nuget.org/packages/CommunityToolkit.Datasync.Client#readme-body-tab
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Datasync.Server" Version="9.0.1" />
<PackageReference Include="CommunityToolkit.Datasync.Server.EntityFrameworkCore" Version="9.0.1" />
<PackageReference Include="CommunityToolkit.Datasync.Server.NSwag" Version="9.0.1" />
<PackageReference Include="CommunityToolkit.Datasync.Server.OpenApi" Version="9.0.1" />
<PackageReference Include="CommunityToolkit.Datasync.Server.Swashbuckle" Version="9.0.1" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.2">
<PackageReference Include="CommunityToolkit.Datasync.Server" Version="9.0.2" />
<PackageReference Include="CommunityToolkit.Datasync.Server.EntityFrameworkCore" Version="9.0.2" />
<PackageReference Include="CommunityToolkit.Datasync.Server.NSwag" Version="9.0.2" />
<PackageReference Include="CommunityToolkit.Datasync.Server.OpenApi" Version="9.0.2" />
<PackageReference Include="CommunityToolkit.Datasync.Server.Swashbuckle" Version="9.0.2" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
8 changes: 4 additions & 4 deletions samples/todoapp-mvc/TodoApp.Service/TodoApp.Service.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Datasync.Server" Version="8.0.3" />
<PackageReference Include="CommunityToolkit.Datasync.Server.EntityFrameworkCore" Version="8.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.11" />
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.1.175" />
<PackageReference Include="CommunityToolkit.Datasync.Server" Version="8.0.7" />
<PackageReference Include="CommunityToolkit.Datasync.Server.EntityFrameworkCore" Version="8.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.5" />
<PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="3.0.71" />
</ItemGroup>

<Target Name="CleanWwwRootLib" AfterTargets="Clean">
Expand Down
4 changes: 2 additions & 2 deletions samples/todoapp-tutorial/ClientApp/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ClientApp.Interfaces;
using ClientApp.Interfaces;
using ClientApp.Services;
using ClientApp.ViewModels;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -29,7 +29,7 @@ private void InitializeApplication()
{
using IServiceScope scope = Services.CreateScope();
IAppInitializer initializer = scope.ServiceProvider.GetRequiredService<IAppInitializer>();
initializer.Initialize();
_ = initializer.Initialize();
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion samples/todoapp-tutorial/ClientApp/ClientApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Datasync.Client" Version="9.0.0" />
<PackageReference Include="CommunityToolkit.Datasync.Client" Version="9.0.2" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Globalization;
using System.Windows.Data;
using System.Windows.Media.Imaging;
Expand Down
2 changes: 1 addition & 1 deletion samples/todoapp-tutorial/ClientApp/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Window x:Class="ClientApp.MainWindow"
<Window x:Class="ClientApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Expand Down
85 changes: 85 additions & 0 deletions samples/todoapp-tutorial/ClientApp/ViewModels/TodoListViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using ClientApp.Interfaces;
using ClientApp.Models;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System.ComponentModel;

namespace ClientApp.ViewModels;

public partial class TodoListViewModel(ITodoService todoService, IAlertService alertService) : ObservableRecipient
{
[ObservableProperty]
private bool isRefreshing;

[ObservableProperty]
private BindingList<TodoItem> items = [];

[ObservableProperty]
private string addItemTitle = string.Empty;

[RelayCommand]
public async Task AddItemAsync(CancellationToken cancellationToken = default)
{
try
{
var addition = await todoService.AddTodoItemAsync(AddItemTitle, cancellationToken);
Items.Add(addition);
AddItemTitle = string.Empty;
}
catch (Exception ex)
{
await alertService.ShowErrorAlertAsync("Error adding item", ex.Message);
}
}

[RelayCommand]
public async Task UpdateItemAsync(TodoItem item, CancellationToken cancellationToken = default)
{
try
{
TodoItem? storedItem = await todoService.GetTodoItemAsync(item.Id, cancellationToken);
if (storedItem is not null)
{
storedItem.IsComplete = !storedItem.IsComplete;
var replacedItem = await todoService.ReplaceTodoItemAsync(storedItem, cancellationToken);
var idx = Items.IndexOf(item);
Items[idx] = replacedItem;
}
else
{
await alertService.ShowErrorAlertAsync("Item not found", "The item was not found in the database.");
}
}
catch (Exception ex)
{
await alertService.ShowErrorAlertAsync("Error updating item", ex.Message);
}
}

[RelayCommand]
public async Task RefreshItemsAsync(CancellationToken cancellationToken = default)
{
try
{
IsRefreshing = true;
List<TodoItem> dbItems = await todoService.GetAllTodoItemsAsync(cancellationToken);
Items.Clear();
foreach (var dbItem in dbItems)
{
Items.Add(dbItem);
}
}
catch (Exception ex)
{
await alertService.ShowErrorAlertAsync("Error refreshing items", ex.Message);
}
finally
{
IsRefreshing = false;
}
}
}
4 changes: 2 additions & 2 deletions samples/todoapp-tutorial/ServerApp/ServerApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Datasync.Server" Version="9.0.0" />
<PackageReference Include="CommunityToolkit.Datasync.Server.InMemory" Version="9.0.0" />
<PackageReference Include="CommunityToolkit.Datasync.Server" Version="9.0.2" />
<PackageReference Include="CommunityToolkit.Datasync.Server.InMemory" Version="9.0.2" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Android" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.1"/>
<PackageReference Include="Avalonia.Android" Version="11.3.0" />
<PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.15" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\TodoApp.Avalonia\TodoApp.Avalonia.csproj"/>
<ProjectReference Include="..\TodoApp.Avalonia\TodoApp.Avalonia.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Avalonia.Desktop" Version="11.3.0" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)"/>
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\TodoApp.Avalonia\TodoApp.Avalonia.csproj"/>
<ProjectReference Include="..\TodoApp.Avalonia\TodoApp.Avalonia.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia.iOS" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Avalonia.iOS" Version="11.3.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\TodoApp.Avalonia\TodoApp.Avalonia.csproj"/>
<ProjectReference Include="..\TodoApp.Avalonia\TodoApp.Avalonia.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
</PropertyGroup>

<ItemGroup>
<AvaloniaResource Include="Assets\**"/>
<AvaloniaResource Include="Assets\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Avalonia.Fonts.Inter" Version="$(AvaloniaVersion)"/>
<PackageReference Include="Avalonia" Version="11.3.0" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.0" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.0" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)"/>
<PackageReference Include="CommunityToolkit.Datasync.Client" Version="9.0.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0"/>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.1" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.0" />
<PackageReference Include="CommunityToolkit.Datasync.Client" Version="9.0.2" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.5" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions samples/todoapp/TodoApp.MAUI/TodoApp.MAUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Datasync.Client" Version="9.0.0" />
<PackageReference Include="CommunityToolkit.Datasync.Client" Version="9.0.2" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.70" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.5" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/todoapp/TodoApp.WPF/TodoApp.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="CommunityToolkit.Datasync.Client" Version="9.0.0" />
<PackageReference Include="CommunityToolkit.Datasync.Client" Version="9.0.2" />
</ItemGroup>
</Project>
8 changes: 4 additions & 4 deletions samples/todoapp/TodoApp.WinUI3/TodoApp.WinUI3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Datasync.Client" Version="9.0.0" />
<PackageReference Include="CommunityToolkit.Datasync.Client" Version="9.0.2" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.2.250402" />
<PackageReference Include="CommunityToolkit.WinUI.Converters" Version="8.2.250402" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.1" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.250108002" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.5" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250401001" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.3916" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>

Expand Down