protected override void WriteResponse(LayimResponse response)
 {
     foreach (var resourceName in _resourceNames)
     {
         WriteResource(response, _assembly, $"{_baseNamespace}.{resourceName}");
     }
 }
Пример #2
0
 public void Assign(RazorPage parentPage)
 {
     Request  = parentPage.Request;
     Response = parentPage.Response;
     Storage  = parentPage.Storage;
     AppPath  = parentPage.AppPath;
     Url      = parentPage.Url;
 }
Пример #3
0
        internal void Assign(LayimContext context)
        {
            Request  = context.Request;
            Response = context.Response;
            Storage  = context.Storage;
            AppPath  = context.Options.AppPath;

            Url = new UrlHelper(context);
        }
Пример #4
0
 protected void WriteResource(LayimResponse response, Assembly assembly, string resourceName)
 {
     using (var inputStream = assembly.GetManifestResourceStream(resourceName)) {
         if (inputStream == null)
         {
             //设置为嵌入的资源
             throw new ArgumentException($@"在{assembly}中{resourceName} 资源未找到.");
         }
         inputStream.CopyTo(response.Body);
     }
 }
Пример #5
0
 protected virtual void WriteResponse(LayimResponse response)
 {
     WriteResource(response, _assembly, _resourceName);
 }