コード例 #1
0
        /// <summary>An Operation extension method that converts an operation to an operation dto.</summary>
        ///
        /// <param name="operation">The operation to act on.</param>
        ///
        /// <returns>operation as an OperationDto.</returns>
        public static OperationDto ToOperationDto(this Operation operation)
        {
            var to = new OperationDto {
                Name         = operation.Name,
                ResponseName = operation.IsOneWay ? null : operation.ResponseType.Name,
                ServiceName  = operation.ServiceType.Name,
                Actions      = operation.Actions,
                Routes       = operation.Routes.ToDictionary(x => x.Path.PairWith(x.AllowedVerbs)),
            };

            if (operation.RestrictTo != null)
            {
                to.RestrictTo = operation.RestrictTo.AccessibleToAny.ToList().ConvertAll(x => x.ToString());
                to.VisibleTo  = operation.RestrictTo.VisibleToAny.ToList().ConvertAll(x => x.ToString());
            }

            return(to);
        }
コード例 #2
0
ファイル: ServiceMetadata.cs プロジェクト: Qasemt/NServiceKit
        /// <summary>An Operation extension method that converts an operation to an operation dto.</summary>
        ///
        /// <param name="operation">The operation to act on.</param>
        ///
        /// <returns>operation as an OperationDto.</returns>
        public static OperationDto ToOperationDto(this Operation operation)
        {
            var to = new OperationDto {
                Name = operation.Name,
                ResponseName = operation.IsOneWay ? null : operation.ResponseType.Name,
                ServiceName = operation.ServiceType.Name,
                Actions = operation.Actions,
                Routes = operation.Routes.ToDictionary(x => x.Path.PairWith(x.AllowedVerbs)),
            };
            
            if (operation.RestrictTo != null)
            {
                to.RestrictTo = operation.RestrictTo.AccessibleToAny.ToList().ConvertAll(x => x.ToString());
                to.VisibleTo = operation.RestrictTo.VisibleToAny.ToList().ConvertAll(x => x.ToString());
            }

            return to;
        }