Hi, Can you tell me what are the steps which I have to follow to update my project to latest ABP. I saw that you have released Zero 1.12.2 and boilerplate 0.11.2.
My project is very old now.Zero : 1.10.1 and boilerplate : 0.9.3.0.
I normally merge the templates manually using KDiff3 tool.So can you give me the links which I should follow to upgrade my project into latest ?
<packages>
<package id="Abp" version="0.9.3.0" targetFramework="net461" />
<package id="Abp.AutoMapper" version="0.9.3.0" targetFramework="net461" />
<package id="Abp.Zero" version="0.9.2.0" targetFramework="net461" />
<package id="Abp.Zero.Ldap" version="0.9.2.0" targetFramework="net461" />
<package id="AutoMapper" version="3.3.1" targetFramework="net461" />
<package id="Castle.Core" version="3.3.3" targetFramework="net461" />
<package id="Castle.LoggingFacility" version="3.3.0" targetFramework="net461" />
<package id="Castle.Windsor" version="3.3.0" targetFramework="net461" />
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net461" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net461" />
<package id="Nito.AsyncEx" version="3.0.1" targetFramework="net461" />
<package id="System.Collections.Immutable" version="1.1.36" targetFramework="net461" />
</packages>
Hi, I have followed this (<a class="postlink" href="https://www.aspnetzero.com/Documents/Development-Guide#token-based-authentication">https://www.aspnetzero.com/Documents/De ... entication</a>) article to set token based authentication.I have successfully done that.After that I have used same token to access below method.
[AbpAuthorize(AppPermissions.Pages_Tenant_PropertyManagement_AddNewProperty)]
public async Task<ListResultOutput<StatusListDto>> GetAllStatusesAsync()
{
//code
}
But it gives below error.Can you tell me why and how to sort out this issue ?
{
"success": false,
"result": null,
"error": {
"code": 0,
"message": "Required permissions are not granted. At least one of these permissions must be granted: Pages.Tenant.PropertyManagement.AddNewProperty",
"details": null,
"validationErrors": null
},
"unAuthorizedRequest": true
}
Another Q : Can you tell me how to hide service layer methods from the Swagger dash board ?
Hi,
I need to expose my app's application layer as WebApi. App is being hosted on Azure.According to the doc,I don't have to do anything.B'cos configuration is already there as like this:
//Automatically creates Web API controllers for all application services of the application
DynamicApiControllerBuilder.ForAll<IApplicationService>(typeof(IPApplicationModule).Assembly, "app").Build();
Q 1 : I have tried to accsess web api as shown below.But it doesn't work.Hope I have done some fundamental thing wrong.Can you tell me how to sortout this issue ?
http://MyApp.azurewebsites.net/api/services/app/getAllStatusesAsync
It gives this message :
{
message: "No HTTP resource was found that matches the request URI 'http://MyApp.azurewebsites.net/api/services/app/getAllStatusesAsync'."
}
Q 2 : If I change the above web api's app
name to island
then do I need to do any changes on Angular side or any other place ?
Q 3 : Can you tell me how to secure the web api service ?
This is the doc which I went through : [http://aspnetboilerplate.com/Pages/Documents/Dynamic-Web-API])
Hi,
I haven't upgraded my project to latest version recently. So If I'll use
get-project -all | get-package | ?{ $_.Id -like 'Abp*' } | update-package
to upgrade my app,will it give issues for my project ? I saw the latest version is V 0.10.0 and saw the number of AspNetCore packages also.Is there any braking changes ? If so please let me know and any if you have any reference please share it too.Thanks.
My Packages.config
<packages>
<package id="Abp" version="0.9.3.0" targetFramework="net461" />
<package id="Abp.AutoMapper" version="0.9.3.0" targetFramework="net461" />
<package id="Abp.EntityFramework" version="0.9.3.0" targetFramework="net461" />
<package id="Abp.Zero" version="0.9.2.0" targetFramework="net461" />
<package id="Abp.Zero.EntityFramework" version="0.9.2.0" targetFramework="net461" />
<package id="Abp.Zero.Ldap" version="0.9.2.0" targetFramework="net461" />
<package id="AutoMapper" version="4.2.0" targetFramework="net461" />
<package id="Castle.Core" version="3.3.3" targetFramework="net451" />
<package id="Castle.LoggingFacility" version="3.3.0" targetFramework="net451" />
<package id="Castle.Windsor" version="3.3.0" targetFramework="net451" />
<package id="EntityFramework" version="6.1.3" targetFramework="net451" />
<package id="EntityFramework.DynamicFilters" version="1.4.10.2" targetFramework="net461" />
<package id="EPPlus" version="4.0.5" targetFramework="net452" />
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net451" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net461" />
<package id="Nito.AsyncEx" version="3.0.1" targetFramework="net451" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net461" />
<package id="System.Collections.Immutable" version="1.1.36" targetFramework="net461" />
<package id="System.Linq.Dynamic" version="1.0.6" targetFramework="net452" />
</packages>
Hi, I have a requirement where need to send the emails to all the registered users of the app (including tenants users) to notify about the system downtime due to data migration or something like that.Can I use Abp's Notification System or Hangfire or something like that ? If so please let me know how to do that ? Thanks.
Hi, I have updated to latest version. But when I was trying to run, it gave this error. Can you tell me why ? Thanks.
{"Found more than one concrete type for given DbContext Type (Abp.Zero.EntityFramework.AbpZeroCommonDbContext`2[IP.Authorization.Roles.Role,IP.Authorization.Users.User]) but none of them defines MultiTenancySideAttribute with Host"}
Stack trace : I don't know from where this is coming.I don't have such folder on my machine. "D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\DefaultDbContextResolver.cs"
at Abp.EntityFramework.DbContextTypeMatcher.GetConcreteType(Type dbContextType) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\DbContextTypeMatcher.cs:line 79
at Abp.EntityFramework.DefaultDbContextResolver.Resolve[TDbContext](String connectionString) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\DefaultDbContextResolver.cs:line 29
at Abp.EntityFramework.Uow.EfUnitOfWork.GetOrCreateDbContext[TDbContext](Nullable`1 multiTenancySide) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Uow\EfUnitOfWork.cs:line 146
at Abp.EntityFramework.Uow.UnitOfWorkExtensions.GetDbContext[TDbContext](IActiveUnitOfWork unitOfWork, Nullable`1 multiTenancySide) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Uow\UnitOfWorkExtensions.cs:line 38
at Abp.EntityFramework.Uow.UnitOfWorkDbContextProvider`1.GetDbContext(Nullable`1 multiTenancySide) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Uow\UnitOfWorkDbContextProvider.cs:line 38
at Castle.Proxies.EfRepositoryBase`2Proxy.get_Context_callback()
at Castle.Proxies.Invocations.EfRepositoryBase`3_get_Context.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 53
at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 45
at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 35
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.EfRepositoryBase`2Proxy.get_Context()
at Abp.EntityFramework.Repositories.EfRepositoryBase`3.get_Table() in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Repositories\EfRepositoryBaseOfTEntityAndTPrimaryKey.cs:line 30
at Castle.Proxies.EfRepositoryBase`2Proxy.get_Table_callback()
at Castle.Proxies.Invocations.EfRepositoryBase`3_get_Table.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 53
at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 45
at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 35
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.EfRepositoryBase`2Proxy.get_Table()
at Castle.Proxies.EfRepositoryBase`2Proxy.GetAll_callback()
at Castle.Proxies.Invocations.EfRepositoryBase`3_GetAll.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 53
at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 45
at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 35
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.EfRepositoryBase`2Proxy.GetAll()
at Abp.EntityFramework.Repositories.EfRepositoryBase`3.<GetAllListAsync>d__7.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Repositories\EfRepositoryBaseOfTEntityAndTPrimaryKey.cs:line 50
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__5`1.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:line 120
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Abp.Localization.ApplicationLanguageManager.<GetLanguagesFromDatabaseAsync>d__17.MoveNext() in D:\Halil\GitHub\module-zero\src\Abp.Zero\Localization\ApplicationLanguageManager.cs:line 204
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__5`1.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:line 120
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Abp.Runtime.Caching.CacheExtensions.<>c__DisplayClass5_0`2.<<GetAsync>b__0>d.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\CacheExtensions.cs:line 40
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Abp.Runtime.Caching.CacheBase.<GetAsync>d__12.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\CacheBase.cs:line 67
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Abp.Runtime.Caching.CacheExtensions.<GetAsync>d__5`2.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\CacheExtensions.cs:line 38
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Abp.Localization.ApplicationLanguageManager.<GetLanguageDictionary>d__15.MoveNext() in D:\Halil\GitHub\module-zero\src\Abp.Zero\Localization\ApplicationLanguageManager.cs:line 178
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Abp.Localization.ApplicationLanguageManager.<GetLanguagesAsync>d__8.MoveNext() in D:\Halil\GitHub\module-zero\src\Abp.Zero\Localization\ApplicationLanguageManager.cs:line 60
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
at Nito.AsyncEx.AsyncContext.<>c__DisplayClass7`1.<Run>b__5(Task`1 t)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
at Nito.AsyncEx.AsyncContext.Run[TResult](Func`1 action)
at Abp.Threading.AsyncHelper.RunSync[TResult](Func`1 func) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Threading\AsyncHelper.cs:line 33
at Abp.Localization.ApplicationLanguageProvider.GetLanguages() in D:\Halil\GitHub\module-zero\src\Abp.Zero\Localization\ApplicationLanguageProvider.cs:line 35
at Abp.Localization.LanguageManager.GetLanguages() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Localization\LanguageManager.cs:line 21
at Abp.Localization.MultiTenantLocalizationDictionaryProvider.GetDictionaries() in D:\Halil\GitHub\module-zero\src\Abp.Zero\Localization\MultiTenantLocalizationDictionaryProvider.cs:line 56
at Abp.Localization.MultiTenantLocalizationDictionaryProvider.get_Dictionaries() in D:\Halil\GitHub\module-zero\src\Abp.Zero\Localization\MultiTenantLocalizationDictionaryProvider.cs:line 25
at Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource.GetStringOrNull(String name, CultureInfo culture, Boolean tryDefaults) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Localization\Dictionaries\DictionaryBasedLocalizationSource.cs:line 84
at Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource.GetString(String name, CultureInfo culture) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Localization\Dictionaries\DictionaryBasedLocalizationSource.cs:line 67
at Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource.GetString(String name) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Localization\Dictionaries\DictionaryBasedLocalizationSource.cs:line 61
at Abp.Web.Mvc.Views.AbpWebViewPage`1.L(String name) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.Web.Mvc\Web\Mvc\Views\AbpWebViewPageOfTModel.cs:line 72
at ASP._Page_Views_Shared_Error_cshtml.Execute() in d:\VersionUpgrade\Version-1.10.1\IP.Web\Views\Shared\Error.cshtml:line 10
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.StartPage.RunPage()
at System.Web.WebPages.StartPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
at System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag)
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
at System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag)
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
at System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Hi, Now Angular 2 RC1 has been released.As a first step of the migration I would like to convert all of my JavaScript files into the fully featured Typescript files.Not just by changing the extension.Hope you're also working on this kind of migration right now for your ABP V 2.Could you give some advices or share your experiences with us about this process ? It'll really help us to convert our apps into Typescript.According to the Angular Upgrade guide [https://angular.io/docs/ts/latest/guide/upgrade.html]) this should be the first step.Hope you'll share your ideas with us. Thanks.
Hi, This is not related to the ABP. But hope your experience will give some advice for me.
On redis helper method where I have maintained 2 Redis connection strings.This is on the Application layer.One is for the local and the other one is for the Azure redis server.Each and every time when I need to publish, I have to change it manually.Do you know any place to set published Redis connection string on the Azure portal or when I do the publish ? We can do that for the db connection string.But what about Redis connection string ? Thanks.
public class RedisConnectorHelper
{
private static readonly Lazy<ConnectionMultiplexer> LazyConnection =
new Lazy<ConnectionMultiplexer>(() => ConnectionMultiplexer.Connect("localhost,ConnectTimeout=10000"));//local host
//private static readonly Lazy<ConnectionMultiplexer> LazyConnection =
// new Lazy<ConnectionMultiplexer>(() => ConnectionMultiplexer.Connect("Myredis.redis.cache.windows.net:6380,password=mypassword,ssl=True,abortConnect=False"));//production
}
Hi,
I'm going to use Redis cache on my app.Other than the Redis cache,I would like to load my drop down related data (master data) within the application layer's method (MycompanyApplicationModule
).Then users will not need to wait for the data base retrievals even for the first time.Hence I'm using Cache,it will not have 2nd time db call anyway. I think we can do it on the PreInitialize()
method. So could you tell me how can I do that ? Is this the right approach ? Hope you'll give feedback.Thanks.
RedisConnectorHelper.cs
public class RedisConnectorHelper
{
private static readonly Lazy<ConnectionMultiplexer> LazyConnection =
new Lazy<ConnectionMultiplexer>(() => ConnectionMultiplexer.Connect("localhost"));
public static ConnectionMultiplexer Connection => LazyConnection.Value;
}
js
vm.getAllCities = function () {
cityService.getAllCitiesAsync().success(function (result) {
vm.cities = result.items;
vm.toRefreshCitySearchableDropDown();
if (vm.cityId != 0) {
vm.getCityName(vm.cityId);
}
});
};
vm.getAllCities();
Html
<div class="form-group">
<label class="control-label">@L("City")</label>
<select id="cityDropDown" required
class="form-control"
ng-options="a.id as a.name + ' | '+ a.zipCode for a in vm.cities"
ng-model="vm.property.address.cityId"
ui-jq="selectpicker"
ui-options='{ iconBase: "famfamfam-flag", tickIcon: "fa fa-check" }'
ng-change="vm.changedCity(vm.property.address.cityId)"
data-live-search="true" title="@L("PfSelectCity")">
<option value=""></option>
</select>
</div>
CityAppService
public async Task<ListResultOutput<CityListDto>> GetAllCitiesAsync()
{
var cache = RedisConnectorHelper.Connection.GetDatabase();
var values = JsonConvert.DeserializeObject<List<CityListDto>>(cache.StringGet(AppConsts.Cities));
if (values != null) return new ListResultOutput<CityListDto>(values.OrderBy(o => o.Name).ToList());//from cache
var cities = await _cityRepository.GetAllListAsync();
cache.StringSet(AppConsts.Cities, JsonConvert.SerializeObject(cities.OrderBy(o => o.Name).MapTo<List<CityListDto>>()));//to cache
return new ListResultOutput<CityListDto>(cities.OrderBy(o => o.Name).MapTo<List<CityListDto>>());
}