microsoft / service-fabric-aspnetcore

This repo contains ASP.NET Core integration for Service Fabric Reliable Services.
Other
152 stars 49 forks source link

Samples for building reliable collection in asp.net core #1

Closed VenkateshSrini closed 7 years ago

VenkateshSrini commented 7 years ago

Hey, I'm not sure whether this is the correct place to ask this question. Can you please let us know through some blogs, documentation or through code samples on how to build Reliable collections using service fabric using ASP.NET core.

I have asked in few forums, but I have not concrete answers for the same.

YTsalko commented 7 years ago

@VenkateshSrini , Here is gist how you can use Reliable Collections in AspNet.Core application - https://gist.github.com/YTsalko/4231e7b8f8ea662b7ef65a38ebfcceec

The main idea is that you need to inject IReliableStateManager to you controller. I hope this will help you.

vturecek commented 7 years ago

@VenkateshSrini Yes there is documentation specific to the asp.net core packages: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-aspnetcore

I'll add this to the readme.md.

To answer your question, @YTsalko is correct, it's just a matter of injecting IReliableStateManager to your controllers. The documentation has an example of that in the section about using Kestrel in a stateful service

VenkateshSrini commented 7 years ago

Hi , Thanks for the link and sample code. But still I have another question under the same topic. So If I write reliable collection in ASP.NET core then will it run as primary one (not as an guest app) on Windows VM based service fabric cluster also.

I see that in the document they are asking us to use the ASP.NET core on .NET framework. SO this will not work on Linux VM based service fabric. correct?

vturecek commented 7 years ago

@VenkateshSrini Correct, the SDK is currently compiled against the full .NET Framework so you will not be able to run it on Linux yet.

VenkateshSrini commented 7 years ago

@vturecek But this defeats the entire purpose of having that in .NET core. The very essence of cross platform is lost. So by what time we can expect this to be targeted for .NET core on Linux also.

vturecek commented 7 years ago

Once Service Fabric is generally available on Linux.

VenkateshSrini commented 7 years ago

@vturecek , Thank for the update and I'm eagerly waiting for it. Now again just to correct my understanding again, so after the Service fabric for Linux is released, then I will be able to write .NET core reliable collection and host them on Service fabric running on Linux as well as Windows VM. I ask this because most of the on-premise data center are all in Windows while when moving to cloud we want to have Linux machine and If I develop against Service Fabric on Windows on prem I would need a seamless migration to on Cloud environment. Please let me know if this is what is expected.

vturecek commented 7 years ago

Yup, that's right. The plan is to target all of our NuGet packages against .NET Standard 2.0, so that you can build your services against any version of .NET that supports .NET Standard 2.0, including .NET Core which will allow you to run your services on either Linux or Windows.