1 #region Copyright notice and license 2 // Copyright 2019 The gRPC Authors 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 #endregion 16 17 using System; 18 19 namespace Grpc.Core 20 { 21 /// <summary> 22 /// Specifies the location of the service bind method for a gRPC service. 23 /// The bind method is typically generated code and is used to register a service's 24 /// methods with the server on startup. 25 /// 26 /// The bind method signature takes a <see cref="ServiceBinderBase"/> and an optional 27 /// instance of the service base class, e.g. <c>static void BindService(ServiceBinderBase, GreeterService)</c>. 28 /// </summary> 29 [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] 30 public class BindServiceMethodAttribute : Attribute 31 { 32 /// <summary> 33 /// Initializes a new instance of the <see cref="BindServiceMethodAttribute"/> class. 34 /// </summary> 35 /// <param name="bindType">The type the service bind method is defined on.</param> 36 /// <param name="bindMethodName">The name of the service bind method.</param> BindServiceMethodAttribute(Type bindType, string bindMethodName)37 public BindServiceMethodAttribute(Type bindType, string bindMethodName) 38 { 39 BindType = bindType; 40 BindMethodName = bindMethodName; 41 } 42 43 /// <summary> 44 /// Gets the type the service bind method is defined on. 45 /// </summary> 46 public Type BindType { get; } 47 48 /// <summary> 49 /// Gets the name of the service bind method. 50 /// </summary> 51 public string BindMethodName { get; } 52 } 53 } 54