# Introduction
With the continuous development of the website system, the complexity of the architecture will change from MVC->SOA->microservices, from simple to complex, from centralized to distributed.
The introduction of the service framework is SOA->microservice process The problem that must be solved.
In the face of the increase in services, the deployment of service distribution, the mutual call between services and services, have to use the service framework to solve.
Based on NET Core 2.0 Standard 2 development, DotEasy.RPC supports transparent calls from the client to the server, just as simple as an implementation call to an interface.
# Features and dependence
1. Automate assembly and construction of related component types using Microsoft.Extensions.Dependency Injection (future considerations modified to Autofac).
2. Serialization of byte streams using [protobuf-net](https://github.com/mgravell/protobuf-net)
3. Generated by [Roslyn](https://github.com/dotnet/roslyn)'s runtime client proxy
4. Communication pipeline and host built on [DotNetty](https://github.com/Azure/DotNetty)
# Related extension library
#### DotEasy.Rpc.Consul
Based conusl register center service find and discover. [https://github.com/steveleeCN87/doteasy.rpc.consul](https://github.com/steveleeCN87/doteasy.rpc.consul)
#### DotEasy.Rpc.Entry
Lazy dedicated library to further hide the customizable service build entry. [https://github.com/steveleeCN87/doteasy.rpc.entry](https://github.com/steveleeCN87/doteasy.rpc.entry)
# Demo
A code example that implements a simple interface and implements separation, with extensions based on asp.net core middleware and console applications
[link](https://github.com/steveleeCN87/doteasy.rpc.demo)
# More
[http://www.cnblogs.com/SteveLee/](http://www.cnblogs.com/SteveLee/)
# How to use
**step 1:**
Download the nuget package and install you project, input the code:
```
Install-Package DotEasy.Rpc -Version 1.0.1
```
or clone the doteasy.rpc source code package.
* Note the project dependent installation
**step 2:**
* Separate your interface and implementation. For example, the interface class name is 'ISample', which contains an interface method 'string SayHello(string name)', the code is as follows:
```
[RpcTagBundle]
public interface ISample
{
string SayHello(string name);
...n
}
```
_**At the 'ISample' interface project or other interface, you must ensure that only the interface definition is in the project.**_
_**Must be on the interface add property name 'RpcTagBundle'.**_
* And in the implementation class name 'Sample'
```
public Sample : ISample
{
string SayHello(string name)
{
return $"hello {name}";
}
}
```
**step 3:**
Applications were established server and client, the server recommended asp.net core to create a client at random, you can use asp.net core, or use the console application, or even the use of .net winform and so support
* At the asp.net core use middlware extend the package before reference the 'Isample' project and 'DotEasy.Rpc.Entry' dependency package, of course, you can also write your own build method.
For example in the server:
```
public static IApplicationBuilder UseConsulServerExtensions(this IApplicationBuilder app, IConfiguration configuration)
{
if (app == null) throw new ArgumentNullException(nameof(app));
BaseServer baseServer = new BaseServer(configuration);
baseServer.RegisterEvent += collection => collection.AddTransient<ISample, Sample>();
baseServer.Start();
return app;
}
```
for example in the console appliaction, you need to quote the 'Entry' lazy package, or you can also write your own build method:
```
class Program
{
static void Main()
{
new TestClient();
}
}
public class TestClient : BaseClient
{
public TestClient()
{
var sample = Proxy<ISample>();
var name = "world";
Console.WriteLine($"{sample.SayHello(name)}");
Console.ReadKey();
}
}
```
_**Just need to reference the interface project, not the implementation project**_
**step 4:**
you can start register service 'consul' or 'etcd' completed, and start client program before start you asp.net core web server, running the result is 'hello world'.
# Change log
## 1.0.2
1. Added precompiled synchronous and asynchronous remote invocation methods, unforcing the use of Task as asynchronous calls and precompiled builds.
## 1.0.1
1. Added Consul registration and callback to implement the configuration of the Consul registry.
2. Added Entry lazy entry class library package to implement Asp.net middleware extension and host based on Console application.
# Next version expectation
1. Replace Microsoft.Extensions.Dependency with Autofac, support batch import of qualified names and improve Ioc container performance.
2. When the 500+ interface(or service) is pre-compiled client(or consumer), the total time needs to be shortened to solve the suspended caused by large-scale pre-compilation.
3. interface auto disponse.
没有合适的资源?快使用搜索试试~ 我知道了~
受微服务启发,长得像兔子的轻量级框架,基于NETCore2.0Standard2核心库-C#-下载
共224个文件
cs:170个
xml:13个
csproj:8个
需积分: 1 0 下载量 103 浏览量
2023-01-10
19:33:43
上传
评论
收藏 932KB ZIP 举报
温馨提示
受微服务启发,长得像兔子的轻量级框架,基于NETCore2.0Standard2核心库-C#-下载
资源推荐
资源详情
资源评论
收起资源包目录
受微服务启发,长得像兔子的轻量级框架,基于NETCore2.0Standard2核心库-C#-下载 (224个子文件)
start-consul.cmd 24B
packages.config 2KB
App.config 58B
ServiceProxyGenerater.cs 22KB
RpcServiceExtensions.cs 14KB
DefaultRedisCacheProvider.cs 13KB
CompilationUnits.cs 13KB
PollyClient.cs 11KB
SharedFileServiceRouteManager.cs 9KB
ConsulServiceRouteManager.cs 7KB
CacheConfig.cs 6KB
DefaultRedisContext.cs 6KB
DefaultDotNettyTransportClientFactory.cs 6KB
DefaultMemoryCacheProvider.cs 6KB
DefaultHealthCheckService.cs 5KB
DefaultMemoryCache.cs 5KB
DefaultServiceExecutor.cs 5KB
ConsistentHash.cs 5KB
ClientProxy.cs 5KB
CachingResources.Designer.cs 5KB
TransportClient.cs 5KB
ServerBase.cs 5KB
ServiceEntryFactory.cs 4KB
ServiceRouteChangedEventArgs.cs 4KB
StackExchangeRedisExtensions.cs 4KB
PollingAddressSelector.cs 4KB
DefaultDotNettyServerMessageListener.cs 4KB
DefaultAuthorizationServerProvider.cs 4KB
RpcDependencyResolverExtensions.cs 3KB
PredicateBuilder.cs 3KB
DefaultRedisCacheClient.cs 3KB
DefaultAddressResolver.cs 3KB
RemoteInvokeService.cs 3KB
AttributeServiceEntryProvider.cs 3KB
ServiceDescriptor.cs 3KB
FormSample.Designer.cs 3KB
TokenMiddleware.cs 3KB
Resources.Designer.cs 3KB
ICacheProvider.cs 3KB
CachingObjectPool.cs 3KB
ServiceProxyBase.cs 3KB
ConsistentHashNode.cs 3KB
TransportMessage.cs 2KB
RpcClient.cs 2KB
DefaultTypeConvertibleService.cs 2KB
DefaultTypeConvertibleProvider.cs 2KB
RpcServiceResolver.cs 2KB
DefaultRelayHttpRouteRpc.cs 2KB
AuthClient.cs 2KB
TestConfig.cs 2KB
Startup.cs 2KB
OcelotPipelineConfigurationExtensions.cs 2KB
HashAlgorithm.cs 2KB
KeepAliveChannelHandlerAdapter.cs 2KB
DefaultServiceRouteFactory.cs 2KB
RandomAddressSelector.cs 2KB
ServiceRoute.cs 2KB
ServiceDescriptorExtensions.cs 2KB
DefaultGCThreadProvider.cs 2KB
DefaultDotNettyMessageClientSender.cs 2KB
RelayRequesterMiddleware.cs 2KB
Startup.cs 2KB
AddressSelectorBase.cs 2KB
DefaultServiceEntryLocate.cs 2KB
ConsulServerExtensions.cs 2KB
AddressModel.cs 2KB
GatewayConfig.cs 2KB
DefaultServiceEntryManager.cs 2KB
CachingCheck.cs 2KB
TransportMessageChannelHandlerEncodeAdapter.cs 1KB
DefaultServiceHost.cs 1KB
CachingContainer.cs 1KB
DefaultRedisEndpoint.cs 1KB
DefaultServiceIdGenerator.cs 1KB
DefaultDotNettyServerMessageSender.cs 1KB
AssemblyInfo.cs 1KB
IpAddressModel.cs 1KB
ConsulServiceMetaInfo.cs 1KB
IServiceRouteManager.cs 1KB
ServiceProxyFactory.cs 1KB
CachingException.cs 1KB
RpcOptionsConfiguration.cs 1KB
StringByteArraySerializer.cs 1KB
IServiceProxyGenerater.cs 1KB
ServiceAddressDescriptor.cs 1KB
ServiceLocator.cs 1KB
StringObjectSerializer.cs 1KB
Settings.Designer.cs 1KB
IAddressSelector.cs 1KB
MemoryWrappedHttpResponseStream.cs 1019B
RpcServiceCollectionExtensions.cs 1003B
IHealthCheckService.cs 995B
TransportMessageChannelHandlerDecodeAdapter.cs 973B
IMessageListener.cs 970B
ServiceHostAbstract.cs 963B
JsonSerializer.cs 952B
CachingEndpoint.cs 947B
IRemoteInvokeService.cs 937B
JsonTransportMessageDecoder.cs 883B
JsonTransportMessageCodecFactory.cs 861B
共 224 条
- 1
- 2
- 3
资源评论
m0_57781768
- 粉丝: 1w+
- 资源: 402
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功