This is how I implemented :
public static void BulkInsert<TEntity, TPrimaryKey>(IRepository<TEntity, TPrimaryKey> repository, IEnumerable<TEntity> entities) where TEntity : class, IEntity<TPrimaryKey>, new() { var enumerable = entities as IList<TEntity> ?? entities.ToList(); if (enumerable.Any()) { if (!Z.EntityFramework.Extensions.LicenseManager.ValidateLicense()) { throw new Exception("Invalid License!"); } var dbContext = repository.GetDbContext(); //dbContext.Set<TEntity>().AddRange(entities); dbContext.BulkInsert(enumerable); } }
The BulkInsert is from Z.Entityframework and it works fine. It also has BulkInserAsync, but the moment I make the method Async and use Await operator I am losing my DbContext. Any reason ?
I will also implement the Caching and update the thread
if (zip.trim().length > 2) {
$.getJSON('http://maps.googleapis.com/maps/api/geocode/json?address=' + zip).success(function (response) {
var city = [],
state = [],
country = [];
//find the city , state and country
if (response.results[0]) {
var address_components = response.results[0].address_components;
Ext.each(address_components, function (component) {
var types = component.types;
Ext.each(types, function (type) {
if (type == 'locality') {
cityField.setValue(component.long_name);
}
if (type == 'administrative_area_level_1') {
state.push({ name: component.long_name, state: component.short_name });
}
if (type == 'country') {
country.push({ name: component.long_name, country: component.short_name });
}
});
});
if (stateCombo && state.length > 0) {
var stateRecord = stateCombo.getStore().findRecord('state', state[0].state);
if (stateRecord) {
stateCombo.select(stateRecord);
}
else {
stateCombo.reset();
}
}
if (countryCombo && country.length > 0) {
var countryRecord = countryCombo.getStore().findRecord('country', country[0].country);
if (countryRecord) {
countryCombo.select(countryRecord);
}
else {
countryCombo.reset();
}
}
}
Can you help me on this ?
I am trying to access the google API from the client side and below is the error I am getting :
XMLHttpRequest cannot load <a class="postlink" href="http://maps.googleapis.com/maps/api/geocode/json?address=4566">http://maps.googleapis.com/maps/api/geo ... dress=4566</a>. Request header field X-XSRF-TOKEN is not allowed by Access-Control-Allow-Headers in preflight response.
Please advise.
Thank You for the response.
Now I found this ZZZ framework to be more useful for second level caching :
// using Z.EntityFramework.Plus; // Don't forget to include this. var ctx = new EntitiesContext();
// The first call perform a database round trip var countries1 = ctx.Countries.FromCache().ToList();
// Subsequent calls will take the value from the memory instead var countries2 = ctx.Countries.FromCache().ToList();
I am not sure how to use it as the repositories does provide the FromCache property.
Hi -
This question if more towards entityframework rather than AspnetZero, but I would like see if i can get some answers.
I have basically 4 tables , let's say A, B, C & D.
C inherits A -- C:A D inherits B -- D:B
A is the header table and B is the detail tables. So there is a foreign key relationship between A & B
var query2 = D.GetAll()
.Include(p => p.B)
.Include(p => p.A)
.Include (p =>p.C)
I am able to access all properties of B & A but unable to access properties of C.
Any help would be appreciated
Should I use Index on TenantID and IsDeleted column as we use it in every query
i am more interested in Second Level Cache for Entity Framework 6.1
<a class="postlink" href="https://efcache.codeplex.com/">https://efcache.codeplex.com/</a>
Can you let me know where should I make the changes to have this implemented in my project.
Thank you for all your help so far.
Thank you sir !!!
I am also evaluating cached db for model store as mentioned below :
<a class="postlink" href="https://www.fusonic.net/en/blog/3-steps-for-fast-entityframework-6.1-code-first-startup-performance/">https://www.fusonic.net/en/blog/3-steps ... rformance/</a>
can you throw some light on how I can implement this with respect to ABP
Hi All -
I am facing some serious slowness when Entityframework loads the data for the first time.
Any idea to make the initial load faster ?
Secondly I would like to use views , so would like to create a view using code first approach. Could you provide some guidance
Thanks, Partha