Database replication in WPF + EF system

Asked

Viewed 166 times

1

I have a sales system in WPF / EF that is in use in different cities, but the database is at headquarters. I am having problems when the city link is very slow, resulting consequently in the slow sale.

I can replicate this database to the local server and then sync it to my central server?

1 answer

1

I think for your case a second level cache should solve. Entity Framework has a package that implements this. You can download it here.

According to the developer’s blog, the setup is quite simple. Put in your configuration class the following:

public class Configuration : DbConfiguration
{
    public Configuration()
    {
        var transactionHandler = new CacheTransactionHandler(Program.Cache);

        AddInterceptor(transactionHandler);

        Loaded +=
          (sender, args) => args.ReplaceService<DbProviderServices>(
            (s, _) => new CachingProviderServices(s, transactionHandler));
    }
}

This alone makes your system more fluid without the need for base replication. However, if the base grows more and demand grows more, there is no magic: we need to invest in infrastructure.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.