Skip to content
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

Blazor for the project #21

Open
thangchung opened this issue May 25, 2019 · 8 comments
Open

Blazor for the project #21

thangchung opened this issue May 25, 2019 · 8 comments

Comments

@thangchung
Copy link
Owner

thangchung commented May 25, 2019

The Blazor road map with a lot of features need to investigate dotnet/aspnetcore#8177

And priority items to work on: https://github.com/aspnet/AspNetCore.Docs/projects/35#card-23892118

What news with Blazor: Docs and .NET Core 3.0 Preview 6 news

Microsoft samples:

Blazor features:

Blazor validation & FluentValidation:

UI:

Real projects:

@thangchung
Copy link
Owner Author

SQL Server with docker-compose guidance at https://docs.docker.com/compose/aspnet-mssql-compose/

@thangchung
Copy link
Owner Author

@thangchung
Copy link
Owner Author

State management discussion and libs at dotnet/aspnetcore#5467

@thangchung
Copy link
Owner Author

@thangchung
Copy link
Owner Author

Trying with SSR with Blazor so that we can be easy to do debug and other stuffs

@thangchung
Copy link
Owner Author

State management (circuit) for blazor at https://gist.github.com/SteveSandersonMS/ba16f6bb6934842d78c89ab5314f4b56

@thangchung
Copy link
Owner Author

thangchung commented Jul 14, 2019

Staring at Grpc.Net.Client, tried it but still got an error when run with .NET Standard 2.1. Example at https://github.com/heikovetter/BlazorGrpcSample. With this coming lib, we can set up gRPC service on the server and use Grpc.Net.Client to call to the server through HttpContext integrated with gRPC, just like an example at https://github.com/grpc/grpc-dotnet/blob/master/examples/Clients/Ticketer/Program.cs

Cool thing for gRPC on DataContract at https://github.com/protobuf-net/protobuf-net.Grpc

@thangchung
Copy link
Owner Author

/// <summary>
/// Ref to https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob/8a942cae26/monitoring/api/AlertSample/Program.cs
/// </summary>
public class ProtoMessageConverter : JsonConverter
{
    public override bool CanConvert(Type objectType)
    {
        return typeof(IMessage).IsAssignableFrom(objectType);
    }

    public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
    {
        var converter = new ExpandoObjectConverter();
        var o = converter.ReadJson(reader, objectType, existingValue, serializer);

        var text = JsonConvert.SerializeObject(o);

        var message = (IMessage)Activator.CreateInstance(objectType);
        return JsonParser.Default.Parse(text, message.Descriptor);
    }

    public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
    {
        writer.WriteRawValue(JsonFormatter.Default.Format((IMessage)value));
    }
}

Usage:

JsonConvert.SerializeObject(data, new ProtoMessageConverter());
var data = JsonConvert.SerializeObject<TData>(data, new ProtoMessageConverter());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant