当前位置: 首页>>代码示例>>C#>>正文


C# DreamContext.GetSuffix方法代码示例

本文整理汇总了C#中DreamContext.GetSuffix方法的典型用法代码示例。如果您正苦于以下问题:C# DreamContext.GetSuffix方法的具体用法?C# DreamContext.GetSuffix怎么用?C# DreamContext.GetSuffix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DreamContext的用法示例。


在下文中一共展示了DreamContext.GetSuffix方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteRecord

 public Yield DeleteRecord(DreamContext context, DreamMessage request, Result<DreamMessage> response)
 {
     string name = context.GetSuffix(0, UriPathFormat.Normalized);
     DeleteRecord(name);
     response.Return(DreamMessage.Ok());
     yield break;
 }
开发者ID:sdether,项目名称:DReAM,代码行数:7,代码来源:directoryservice.cs

示例2: GetBlueprints

 public Yield GetBlueprints(DreamContext context, DreamMessage request, Result<DreamMessage> response)
 {
     string sid = context.GetSuffix(0, UriPathFormat.Original);
     XDoc result = null;
     Dictionary<string, XDoc> blueprints = _blueprints;
     if(blueprints != null) {
         lock(blueprints) {
             blueprints.TryGetValue(sid, out result);
         }
     }
     if(result != null) {
         response.Return(DreamMessage.Ok(result));
     } else {
         response.Return(DreamMessage.NotFound(string.Format("could not find blueprint for {0}", sid)));
     }
     yield break;
 }
开发者ID:maximmass,项目名称:DReAM,代码行数:17,代码来源:DreamHostService.cs

示例3: GetRecord

        public Yield GetRecord(DreamContext context, DreamMessage request, Result<DreamMessage> response)
        {
            XDoc doc = null;
            string name = context.GetSuffix(0, UriPathFormat.Normalized);
            lock(_directory) {
                DirectoryRecord record;
                if(_directory.TryGetValue(name, out record)) {
                    doc = record.Value;
                }
            }

            // check if we should look into a parent directory
            if(doc == null) {
                if(_parent != null) {
                    Result<DreamMessage> result;
                    yield return result = _parent.At("records", context.GetSuffix(0, UriPathFormat.Normalized)).Get(new Result<DreamMessage>(TimeSpan.MaxValue));
                    if(!result.Value.IsSuccessful) {

                        // respond with the error code we received
                        response.Return(result.Value);
                        yield break;
                    }
                    doc = result.Value.ToDocument();
                } else {
                    response.Return(DreamMessage.NotFound("record not found"));
                    yield break;
                }
            }
            response.Return(DreamMessage.Ok(doc));
            yield break;
        }
开发者ID:sdether,项目名称:DReAM,代码行数:31,代码来源:directoryservice.cs

示例4: PutRecord

        public Yield PutRecord(DreamContext context, DreamMessage request, Result<DreamMessage> response)
        {
            DirectoryRecord record = new DirectoryRecord();
            record.Name = context.GetSuffix(0, UriPathFormat.Normalized);
            record.Value = request.ToDocument();
            int ttl = context.GetParam<int>(TIME_TO_LIVE, -1);
            if(ttl >= 0) {
                record.Expiration = DateTime.UtcNow.AddSeconds(ttl);
            }

            // add value to directory
            InsertRecord(record);
            response.Return(DreamMessage.Ok());
            yield break;
        }
开发者ID:sdether,项目名称:DReAM,代码行数:15,代码来源:directoryservice.cs


注:本文中的DreamContext.GetSuffix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。