aspnetboilerplate

Extend ClaimsAbpSession

為{幸葍}努か 提交于 2019-12-13 03:23:09
问题 I need to extend the ClaimsAbpSession and create new properties to be sent in the requests between the angular app and the server. Actually, I´ve stored these new properties using claims. But when the user refreshes the page, the values in the claims are lost. 回答1: MyAppSession.cs // Define your own session and add your custom field to it. // Then, you can inject MyAppSession and use its new property in your project. public class MyAppSession : ClaimsAbpSession, ITransientDependency { public

Email sending in aspnetboilerplate not working

五迷三道 提交于 2019-12-13 02:48:23
问题 This is the settings: AddSettingIfNotExists(EmailSettingNames.DefaultFromAddress, "abc@xyz.tech"); AddSettingIfNotExists(EmailSettingNames.DefaultFromDisplayName, "abc.tech Emailservice"); AddSettingIfNotExists(EmailSettingNames.Smtp.UserName, "abc@xyz.tech"); AddSettingIfNotExists(EmailSettingNames.Smtp.Domain, "abc.tech"); AddSettingIfNotExists(EmailSettingNames.Smtp.EnableSsl,"false"); AddSettingIfNotExists(EmailSettingNames.Smtp.Host, "webmail.abc.tech"); AddSettingIfNotExists

How to use Stored Procedure in asp.net core with boilerplate architecture?

拥有回忆 提交于 2019-12-13 02:47:58
问题 I am using asp.net core application with abp(Asp.net BoilerPlate) framework. I want to use stored procedure to get the data and also to implement CRUD operations in this code first architecture. What will be best way to do so? Thanks in advance 回答1: Here is an example that sends a parameter to a stored procedure to delete a user: public async Task DeleteUser(EntityDto input) { await Context.Database.ExecuteSqlCommandAsync( "EXEC DeleteUserById @id", default(CancellationToken), new

Add-Migration not working with MySQL

梦想与她 提交于 2019-12-13 00:27:23
问题 I have downloaded Asp.Net MVC 5.x Single page web application from https://aspnetboilerplate.com/Templates. I'm using MySQL and followed the steps mentioned in link https://aspnetboilerplate.com/Pages/Documents/EF-MySql-Integration. But when I run the Add-Migration command it gives the error. MyCompany.MyProject.Web\Web.Config: <add name="Default" connectionString="Server=127.0.0.1;port=3306;Database=SparTestDb;uid=root;password=root" providerName="MySql.Data.MySqlClient"/> MyCompany

OpenID Connect Integration

≯℡__Kan透↙ 提交于 2019-12-13 00:18:39
问题 ASP.NET Boilerplate unlike ASP.NET Zero does not contain the OpenID Connect support to a third-party Identity Solution. An older post on the ASP.NET Boilerplate forum (Support for Open ID and JWT?) discusses this topic but does not provide any code example on how to approach this. Has anyone tried this already? It would be fine if this feature could be added to ASP.NET Boilerplate as well... 回答1: If you want to make your application openid connect client (not server) you can just use

Implement OrganizationUnit filter in ASP.NET Core

旧街凉风 提交于 2019-12-12 09:23:35
问题 In ASP.NET Boilerplate, there are built-in Data Filters like Tenant filter, and we could use SetTenantId to enable querying specific tenantId . As per the official document, it did not support custom Filter in EF Core, unlike EF 6.x. I am wondering how to achieve a similar filter for OrganizationUnitId parameter. This is what I have done so far: Override CreateFilterExpression : protected override Expression<Func<TEntity, bool>> CreateFilterExpression<TEntity>() { Expression<Func<TEntity,

How to call Web API (App Service) remotely

霸气de小男生 提交于 2019-12-12 04:43:58
问题 I need to call an API from AppService by uri. This is my API: public ApiOutputBase Test_AddStudent(string name, int age, string address) { return new ApiOutputBase { Result = new Result { Status = true, Message = "OK,Test_AddStudent Done!" }, OuputValues = new List<object>() { name, age, address } }; } I use this Function to call it: public async Task<bool> TestCallApi() { var client = new HttpClient { BaseAddress = new Uri("http://localhost/") }; client.DefaultRequestHeaders.Accept.Clear();

ABP 401 response from API instead of redirect

[亡魂溺海] 提交于 2019-12-12 04:19:12
问题 I have the same problem as this: https://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=4865, but I have ABP v2.1 with module-zero-core-template. I'm using Web.Mvc project as my startup project and I want to make API calls. When I perform an unauthorized request to the API, I got a "200 OK" response instead of a "401". Where did I make a mistake? 回答1: ASP.NET Core 1.x ABP v2.x / module-zero-core-template v2.x Modify IdentityRegistrar in .Core project: // Before services.AddAbpIdentity<Tenant

Cannot delete record from table which has Identity column

↘锁芯ラ 提交于 2019-12-12 04:04:11
问题 I have a table which has the code as primary key instead of Id, When I call DeleteAsync method I get the exception Message = "Cannot update identity column 'Id'." . [Table("Test")] public class Test: FullAuditedEntity<int> { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] new public int Id { get; set; } [Key] [DatabaseGenerated(DatabaseGeneratedOption.None)] public virtual int Code { get; set; } public async Task DeleteTest(int code) { try { await _supplierRepository.DeleteAsync(p => p

How to tell use relevant registered MySession class by name

妖精的绣舞 提交于 2019-12-12 01:27:20
问题 I have project created from Boilerplate I have MySession class that will be used from MvcControllers and WebApi Controllers. In MySession has two derived classes: MySessionMvc: public override string UserId { get { return Thread.CurrentPrincipal.Identity.GetUserId(); } } and MySessionWebApi: public override string UserId { get { System.Web.HttpContext.Current.Request.Headers["UserId"]; } } I register both classes: IocManager.RegisterIfNot<IMySession, MySessionMvc>(DependencyLifeStyle