Skip to content

Latest commit

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

CloudSharp

D-ASYNC CloudSharp is an extension to C# language that introduces new paradigms of service-oriented cloud programming. The new syntax removes the need to use or to create a framework for service APIs, inter-service communication, workflows, and state management.

Concepts

The basic concepts define a serivce and its contract, most common communication primitives: query, command, event, event handler.

Service Contract (API Surface)

// A service API contract that is transpiled into an interface.servicecontract IUserService
{queryList<User> GetActiveUsers();commandvoid Register(stringname,stringemail);commandbool SuspendUser(stringuserId);eventEventHandler<User> UserRegistered;}

Service Logic, Event Publishing

// A service implementation that is transpiled into a class.serviceUserService: IUserService
{commandvoid Register(stringname,stringemail){varuser=newUser(name,email);// .....// Publish an event.publishUserRegistered(this,user);}}

Event Handlers

serviceRewardService{publicRewardService(IUserService userService){// Subscribe to an event of another service.subscribeOnUserRegistered to userService.UserRegistered;}// An event handler.handlerOnUserRegistered(objectsender,Useruser){// .....}}

Persisted Workflows

serviceOrderService{commandProcessOrder(Orderorder){// The variable is saved as a part of the execution state.persistedGuid transactionId =Guid.NewGuid();// Save execution state of this method when invoke the command.followProcessPayment(order,transactionId);try{followReserveItems(order);}catch(OutOfStockException){// Use saved transaction ID to guarantee idempotency.followCancelPayment(transactionId);throw;}followShipItems(order);}commandProcessPayment(Orderorder,GuidtransactionId){ .....}commandCancelPayment(GuidtransactionId){ .....}commandReserveItems(Orderorder){ .....}commandShipItems(Orderorder){ .....}}

Why CloudSharp

The ability to describe higher level concepts using the syntax of a programming language itself produces at least 5 times less code, makes the program more readable, saves a lot of time to understand and maintain a multi-service application.

Releases

Packages

Contributors