blazor-server-side

How to remove multiple cascade paths in entity framework

让人想犯罪 __ 提交于 2021-01-29 17:22:57
问题 I am trying to define relationships between tables, but getting the following error: Introducing FOREIGN KEY constraint 'FK_QProducts_Quotes_QuoteId' on table 'QProducts' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.Could not create constraint or index. See previous errors. This is how my tables look like: What I am trying to achieve: A. Client creates an inquiry and adds products and quantities that he

Server Error 403 Forbidden on Blazor server app published to Linux hosting

亡梦爱人 提交于 2021-01-29 15:28:16
问题 I want to deploy a Hello World Blazor Server App created with the Blazor App Source Template 3.1.11 in VS2019 C# The app is created in VS2019 on Windows 10 The docs show how to create the /bin/Release/{TARGET FRAMEWORK}/publish folder I copied the files here to the domain folder in my hosting package, but do not know the next step. web.config is for windows hosting. What do I need to do for Linux? At the moment I get a 403 error if I go to the site. I can publish the app to a windows hosted

Service Lifetimes in Blazor and Navigation

非 Y 不嫁゛ 提交于 2021-01-29 12:05:48
问题 Asumme this setup: Page1: - Component A - Component B Page2: - Component C - Component D Service: MyService I want Component A und B to get the same instance of MyService. Component C and D should get a fresh (and the same) instance of MyService. When I register MyService as transient each Component gets a fresh instance. When I register as singleton / scoped all components share the same instance. Components are part of library and thus I am looking for solution that requries no or very

Owl Carousel not working with ASP.NET Blazor

白昼怎懂夜的黑 提交于 2021-01-29 10:13:39
问题 I have been trying to make this owl carousel work. I am not getting any error but the carousel if not loading. I tried the solution I found on StackOverflow for Bootstrap carousel but it did not work for me. I also tried to use pure CSS carousel but it will be static kind of thing and I want the carousel to work dynamically. Index.razor @page "/" @using TBS.Data; @inject IJSRuntime JsRuntime; @*@inject IComponentContext context;*@ @inject NavigationManager UriHelper; @inject MediaService

Use injected service from JS code to static Blazor method

拜拜、爱过 提交于 2021-01-28 12:28:58
问题 I have an app that uses a jQuery lib to show 'confirmation' dialogs. When a user clicks 'OK' or 'Cancel' on the dialog, then first a callback is made to my Javascript code. From there I do a call to a Blazor method, based on the decision the user made. This all looks something like this: My js code: $('.alert-yesno).on('click', function() { // For simplicity I immediately call the Blazor method DotNet.invokeMethodAsync('[Assembly name]', 'DoSomething') .then(data => { // do something... }); }

Dynamically create CascadingValue in custom base component class

雨燕双飞 提交于 2021-01-28 11:09:40
问题 I'm using a custom base component class from which every custom page inhertits from. I do not have any razor code, because it won't be templated in my my base component class - it is only supposed to contain some base logics and intialization stuff. Now i want do wrap around a cascading value, because on any component/page which will be nested within any child level should get access to a property value of my base class. How can i do this, i tried to fake some childContent on the base

How to get EditContext.Validate() to work when binding EditForm to an array

会有一股神秘感。 提交于 2021-01-28 10:21:50
问题 I created an EditForm wrapping a table like so: **Index.razor** @using System.ComponentModel.DataAnnotations; <EditForm @ref="Form" Model="vms" OnSubmit="Submit"> <DataAnnotationsValidator></DataAnnotationsValidator> <table class="table"> <thead> <tr> <th>Code</th> </tr> </thead> <tbody> @foreach (var vm in vms) { <tr> <td> <InputText @bind-Value="vm.Code"></InputText> <ValidationMessage For="@(() => vm.Code)"></ValidationMessage> </td> </tr> } </tbody> </table> <input type="submit" class=

Blazor WebAssembly template not found in Blazor new project

只愿长相守 提交于 2021-01-28 05:36:52
问题 I have installed dotnet SDK 3.1.201 to Microsoft Visual Studio Professional 2019 Version 16.5.4 and I installed this template dotnet new -i Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview5.20216.8 after that I statred to create a new Blazor project in VS just only contains the Blazor Server App template I didn't find the Blazor WebAssembly App template what is wrong with all steps that I have done. 回答1: I have the same problem when I tried to install the template, my

How can I publish a blazor client/server app to a linux web server? Don't have access to ssh and dotnet publish doesn't give an index.html

爷,独闯天下 提交于 2021-01-27 22:16:03
问题 I've built a blazor app that has no issues at the moment. When I call "dotnet publish -c Release" I get a published project, except the output is an executable file that ubuntu picks up as an octet-stream or something along the lines. If I run it, it just opens the server on localhost:5000. Copying this to my web server through cpanel did nothing -- even trying to test out a generic blazor Wasm app and publishing it gave me an index.html, but it would never actually load anything when I

How to render a Blazor component into an HTML string

天大地大妈咪最大 提交于 2021-01-22 00:31:33
问题 I'm looking for a way to render a Blazor component into an HTML string, so that I'll be able to use it as a templating engine to create and send emails in my web application. Ideas? 回答1: Yes, you can use the test library provided by Steve Sanderson and adapt it to your needs. This article explains how to use it : Introduction to Blazor Component Testing . The library can be use to generate the HTML of a component. exemple : var host = new TestHost(); var component = host.AddComponent