blazor

Blazor WebAssembly Environment Variables

戏子无情 提交于 2020-08-27 05:45:20
问题 I'm currently working on a .NET Standard 2.1 Blazor WebAssembly application. I try to include or exclude Stylesheets according to an environment variable. In .NET Core there are usually Environment Tag Helpers like in the following example: <environment include="Development"> <link rel="stylesheet" href="css/style.css" type="text/css" /> </environment> <environment exclude="Development"> <link rel="stylesheet" href="css/style.min.css" type="text/css" /> </environment> This works perfectly

Blazor WebAssembly Environment Variables

杀马特。学长 韩版系。学妹 提交于 2020-08-27 05:45:10
问题 I'm currently working on a .NET Standard 2.1 Blazor WebAssembly application. I try to include or exclude Stylesheets according to an environment variable. In .NET Core there are usually Environment Tag Helpers like in the following example: <environment include="Development"> <link rel="stylesheet" href="css/style.css" type="text/css" /> </environment> <environment exclude="Development"> <link rel="stylesheet" href="css/style.min.css" type="text/css" /> </environment> This works perfectly

Blazor WebAssembly Environment Variables

久未见 提交于 2020-08-27 05:45:07
问题 I'm currently working on a .NET Standard 2.1 Blazor WebAssembly application. I try to include or exclude Stylesheets according to an environment variable. In .NET Core there are usually Environment Tag Helpers like in the following example: <environment include="Development"> <link rel="stylesheet" href="css/style.css" type="text/css" /> </environment> <environment exclude="Development"> <link rel="stylesheet" href="css/style.min.css" type="text/css" /> </environment> This works perfectly

how to jwt authentication blazor server without microsoft identity?

本小妞迷上赌 提交于 2020-08-26 10:48:07
问题 i'm using blazor server ( not use webapi, httpclient and ...) and i want to use jwt for authentication Where should I store token? localStorage or cookie? how to send jwt to server all of the request? I had to use AuthenticationStateProvider? I used httpContext but I got an error unless it fit into the cshtml file I also used localstorage inside AuthenticationStateProvider but just got an error also , which one is better? blazor server (one project) or blazor server with webapi?(two project,

Configure Serilog Elasticsearch in Blazor WebAssembly

偶尔善良 提交于 2020-08-26 09:54:29
问题 I'm currently working on a .NET Standard 2.1 Blazor WebAssembly hosted application. I use Serilog with ElasticSearch and want to send log messages from my Client project to the ElasticSearch server. My project structure looks like this: BlazorApp.Client (I want to send logs to ElasticSearch from here) BlazorApp.Server A similar question is asked here: Serilog Not Logging to ElasticSearch in Blazor WebAssembly I figured out how to send Logs using Serilogs .WriteTo.ElasticSearch() but I always

Blazor InputText: conditionally rendering an attribute

落花浮王杯 提交于 2020-08-25 04:43:37
问题 Blazor vRC1 I'm looking for a straightforward technique on how to conditionally render an attribute within an <InputText> (or any of the input components for that matter). This used to be simple in MVC Razor, where you'd just write the conditional logic within the @(...) statement. Now, writing @(...) has different meaning in the Razor syntax. For example, I'd like to conditionally output the autofocus HTML attribute for InputText . <InputText @bind-Value="@TextProperty" @(MyModel.isAutoFocus

Blazor InputText: conditionally rendering an attribute

纵然是瞬间 提交于 2020-08-25 04:43:12
问题 Blazor vRC1 I'm looking for a straightforward technique on how to conditionally render an attribute within an <InputText> (or any of the input components for that matter). This used to be simple in MVC Razor, where you'd just write the conditional logic within the @(...) statement. Now, writing @(...) has different meaning in the Razor syntax. For example, I'd like to conditionally output the autofocus HTML attribute for InputText . <InputText @bind-Value="@TextProperty" @(MyModel.isAutoFocus

How to do client-side UI events in Blazor

拜拜、爱过 提交于 2020-08-22 03:33:27
问题 I just started playing around with Blazor and I can already see the great potential of this new framework. I'm wondering, though, how it will handle doing simple things like setting focus on an input control? For instance, after I handle a click event, I want to set the focus to a text input control. Do I have to use JQuery for something like that, or will Blazor have some built-in methods for that sort of thing? Thanks Update: I posted an answer below with an example of how to set the focus

Visual Studio开发利器,CodeRush全新发布v20.1.6——支持Blazor

为君一笑 提交于 2020-08-20 03:42:39
CodeRush 能帮助你以极高的效率创建和维护源代码。Consume-first 申明,强大的模板,智能的选择工具,智能代码分析和创新的导航以及一个无与伦比的重构集,在它们的帮助下能够大大的提高你效率。 CodeRush v20.1.6新版下载 具体更新内容如下: Visual Studio 2019的CodeRush菜单位置自定义中的更改 Visual Studio 2019 16.4及更高版本现在允许您指定应放置CodeRush菜单的位置,因此已删除了较旧的CodeRush选项(位于Quick Setup选项页面上),这也使您在启动时性能得到提升(在典型的开发机器上节省了大约1600ms )。 默认情况下,CodeRush菜单位于Visual Studio Extensions菜单中。 如果您想将CodeRush菜单重新定位到Visual Studio菜单栏的顶层(建议使用CodeRush获得更高效率编码体验的大多数开发人员),请按照以下步骤操作: 打开Visual Studio 2019 选择Extensions -> Customize Menu... 在Extensions Menu标签中取消选中CodeRush entry 重新启动Visual Studio 支持Blazor .razor文件中@code部分中现已提供以下CodeRush功能: Smart Dot

2020-06-11-ASP.NET Core Blazor 子组件父组件数据同步的问题

强颜欢笑 提交于 2020-08-19 16:47:06
上一篇写 数据绑定 的文章,写到最后留了一个坑。当子组件绑定父组件的一个字段,并且子组件修改它的时候父组件不能实时进行同步更新UI的问题,最近终于在 Blazui 作者的指导下搞定了。 UserInfo类要实现INotifyPropertyChanged接口 public class UserInfo: INotifyPropertyChanged { private string _userName; public string UserName { get { return _userName; } set { _userName = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(UserName))); } } public string Sex { get; set; } public DateTime BrithDay { get; set; } public event PropertyChangedEventHandler PropertyChanged; } 没想到微软blazor还是借用了WPF搞MVVM的模式,模型需要实现INotifyPropertyChanged类,在属性发生修改的时候可以发出通知。 父组件订阅PropertyChanged事件: @page