Thanks for any tips! :(
<cite>MikaTmlVertti: </cite> @ismcagdas Hi, I am unable to see links contents. My github profile (MikaTml) is linked to aspnetzero, but not aspnetboilerplate.
That repository changed.
New link to this files
<a class="postlink" href="https://github.com/aspnetboilerplate/module-zero-forsaken/blob/dev/src/Abp.Zero.Common/Organizations/OrganizationUnitManagerExtensions.cs">https://github.com/aspnetboilerplate/mo ... ensions.cs</a>
<a class="postlink" href="https://github.com/aspnetboilerplate/module-zero-forsaken/blob/dev/src/Abp.Zero.Common/Organizations/OrganizationUnitManager.cs">https://github.com/aspnetboilerplate/mo ... Manager.cs</a>
Hi, I'm a HighSchool student. I can suggest you to use DEVELOPING STEP BY STEP. Well document for all level of knowing
Could someone explain to me with a real code? For example, How to caching the list of all the countries from DB in the cache then calling the caches for country list output? :( :? :cry: :| :roll:
Hi, Thank you for reply. So how can you get/set item list in memory cache using Abp cache for entities with minor modifications and high usage? e.x Countries list and they States or Provinces (for a address based app)?
Hi again. I can't find my solution in ABP docs. I have a cache named "App.Adresses". In this cache I have more keys pattern named "Addresses." , "AddressAttribute." and "AddressAttributeValue." Then I writing my items with something like this method :
public async Task<IList<AddressAttributeDto>> GetAllAddressAttributes()
{
var key = "AddressAttribute.";
return await _cacheManager.GetCache("App.Adresses").Get(key, async () =>
{
var query = from aa in (await _addressAttributeRepository.GetAllListAsync())
orderby aa.DisplayOrder, aa.Id
select aa;
return ObjectMapper.Map<IList<AddressAttributeDto>>(query.ToList());
});
}
public async Task<AddressAttributeDto> GetAddressAttributeById(EntityDto<long> input)
{
var key = string.Format("AddressAttribute.id-{0}", input.Id);
return await _cacheManager.GetCache("App.Adresses").Get(key, async () =>
{
var addressAttribute = await _addressAttributeRepository.FirstOrDefaultAsync(input.Id);
var output = ObjectMapper.Map<AddressAttributeDto>(addressAttribute);
});
}
Question is How you can remove all items in App.Addresses WHERE cache item name contains "AddressAttribute." No matter the item identifier and clear all(only AddressAttribute items) .
Thank you! I missed few lines of documents.
Hi,
How can you remove items from cache by key pattern when using ITypedCache?
I want remove only just updated entities in myAppService
Please give me an example. Thank you
If your question is related to the base fields in YourProject.xml/json you need to implement a method to read xml/json and write it on the database. The fact that you can include a variety of sources(xml/json/system file/resx) in your code is one of the unique features of this framework. As a customer, we can not expect the development team to include 750 translation fields in database seed when that xml/json source solve users need's.
So, you can use ApplicationTextRepository and ApplicationTextManager to add your own locale keys or xml resources to Db.
public async Task ImportResourcesFromXml(ApplicationLanguage language, string xml, bool updateExistingResources = true)
{
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xml);
var nodes = xmlDoc.SelectNodes(@"AddressToYourXml");
var existingResources = _appTxtRepo.GetAll().Where(txt => txt.LanguageName == language.Name);
foreach (XmlNode node in nodes)
{
var name = node.Attributes["name"].InnerText.Trim();
var value = "";
var valueNode = node.SelectSingleNode("value");
if (valueNode != null)
value = valueNode.InnerText;
if (string.IsNullOrEmpty(name))
continue;
var resource = existingResources.FirstOrDefault(x => x.Key.Equals(name, StringComparison.InvariantCultureIgnoreCase));
if (resource != null)
{
if (updateExistingResources)
{
resource.Value = value;
}
}
else
{
await _appTxtManager.UpdateStringAsync(language.Name, CultureInfoHelper.Get(language.Name), name, value );
}
}
}
CODE NOT COMPILED It's just for sample. If you need help for read/write xml resource please leave comment here I can help you with simple code.
<cite>alper: </cite> Actually you don't need to implement IHaveTest. I misunderstood your Tests for students. Ignore it.
My English is bad, very bad, I know :D Sir Thank you again