🚨 Vendr is now Umbraco Commerce 🚨
RELEASE

Vendr 3.0.0 Release Candidate

05 September 2022

Vendr 3.0.0 RC brings an updated persistence layer and a number of API improvements. Find out all you need to know about this release and how you can get your hands on it.

Vendr 3.0.0 Release Candidate

Three months ago we announced our plans for Vendr v3 and today we are pleased to announce the v3 release candidate.

Vendr v3 RC

Fundamentally, v3 does have a few API changes (we'll cover these shortly) but the main update is that it is now .NET Core only and we are closing the chapter on support for Umbraco v8 and the .NET Framework.

Our goal with v3 really is to get Vendr ready for the next stage of it's development and set a foundation we can continue that development on. Whilst maintaining v8 support was a worthwhile stepping stone, we think with Umbraco now on v10 LTS, and more and more people making the move to .NET Core, it's time to focus on the future.

Another goal of Vendr v3 was also to reduce some Umbraco dependencies around our persistence layer. Whilst building on top of Umbraco's APIs for this did aid our initial development, we felt it was important to regain control of our own implementations as we were finding more scenarios where the needs of an e-commerce system were different to that of a CMS and so different approaches were needed.

What's new in Vendr v3?

IVendrBuilder

Prior to v3, Vendr configuration was performed either against the Composer in v8 or the IUmbracoBuilder in v9+, however now that we no longer need to support Umbraco v8 it's allowed us to more easy define our own configuration API and so for this we now have an IVendrBuilder.

The IVendrBuilder interface can be accessed via a delegate function passed to the AddVendr extension used when registering Vendr explicitly.

public class Startup
{
    ...
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddUmbraco(_env, _config)
            .AddBackOffice()
            .AddWebsite()
            .AddVendr(vendrBuilder => {
                // Configure Vendr here
            })
            .AddComposers()
            .Build();
    }
    ...
}

The IVendrBuilder interface follows a very similar API to that of the IUmbracoBuilder having it's own Services, Configuration and WithCollectionBuilder methods. With this update, all extensions to Vendr should be moved to the IVendrBuilder instead of using the IUmbracoBuilder however this isn't a requirement so your existing code should continue to run without modification.

Unit of Work Changes

One of the most obvious API changes that has been made to Vendr v3 is around our unit of work pattern. Whilst our previous implementation had transient fault handling support, it was only handling faults at the individual command level and not at the work unit level. To resolve this we've introduced a new Execute method on the IUnitOfWorkProvider that accepts an action to encapsulate the unit of work.

Before:

using (var uow = _vendrApi.UoW.Create()) 
{
    // Your logic goes here
}

After:

_vendrApi.UoW.Execute(uow => {
    // Your logic goes here
});

By wrapping the work unit in an action like this it means we can rerun the entire unit if there is a fault, rather than just individual commands.

Vendr Specific Connection String

Another nice side effect of implementing our own persistence layer is that it has made it super easy to support a Vendr specific connection string, thus allowing you to store your Vendr data in a different database to that of your Umbraco content.

To configure a Vendr connection string, it's a case of adding a new connection string + provider name to your connection strings section in the app settings file with the key vendrDbDSN.

{
    ...
    "ConnectionStrings": {
        "umbracoDbDSN": "Server=umbracoServerAddress;Database=myUmbracoDb;User Id=myUsername;Password=myPassword;",
        "umbracoDbDSN_ProviderName": "Microsoft.Data.SqlClient",
        "vendrDbDSN": "Server=vendrServerAddress;Database=myVendrDb;User Id=myUsername;Password=myPassword;",
        "vendrDbDSN_ProviderName": "Microsoft.Data.SqlClient"
    },
    ...
}

Optional SQLite Support

Whilst Vendr v2 already supports SQLite, v3 moves this support into an optional package. During our performance testing it became clear that running Vendr on SQLite with the potential for concurrent cart sessions, SQLite is not a production suitable solution, so we decided to push the SQLite implementation to an optional package that you can install and configure for testing purposes.

You can install the SQLite NuGet package via the following command.

dotnet add package Vendr.Persistence.Sqlite

Once the NuGet package is installed, you'll then need to register SQLite support with Vendr via the IVendrBuilder interface.

...
.AddVendr(vendrBuilder => {
    vendrBuilder.AddSQLite();
})
...

Assuming Umbraco is running via a SQLite database, Vendr will now just connect to the same database to run. Alternatively you can register a separate connection using a custom connection string as mentioned above.

Other Updates

  • Optimistic concurrency checks when persisting an entity now ensures an entity can't be overwritten with stale state.
  • AsWritable now fetches the latest entity state from the database rather than just taking a snapshot of the given entities read only state.
  • Added DB indexes on orderId and storeId columns for better DB performance.
  • Added async support to payment forms via the new BeginPaymentFormAsync method.
  • Added support for bundle base price adjustments.
  • Introduced new BundleOrderLine and BundledOrderLine for strongly typed access to bundle specific features.
  • Add new IsBundle and GetBundles methods to make working with bundles easier.
  • Added default values support to payment provider / discount settings objects.

Bug Fixes

  • Reverting an order now only reverts finalized orders (carts should not get reverted).

Where to get it?

Vendr v3 RC can be accessed from our pre-release NuGet feed at https://nuget.outfield.digital/prerelease/vendr/v3/index.json

Alternatively, you can also trial it by running our demo store available at https://github.com/vendrhub/vendr-demo-store/tree/v3/dev

What next?

We've already performed some extensive performance tests on Vendr v3 to ensure our persistence layer changes don't have any adverse effects and we will continue to do further tests as we upgrade our add-on packages and demo store implementation, but we would really appreciate feedback on our issue tracker should you find any issues in your own testing. 

If developers have any questions on implementing the changes from v2, these should be asked on the Umbraco developer portal support forums.

Can I use Vendr v3 now?

Yes. With Vendr v3 moving into an RC phase we are pretty confident that what we have is close to the finished product and as such we don't expect to be making any major changes prior to release. 

When will Vendr v3 be released?

We'll be giving 2 weeks inorder to give people enough time to test and report back any issues, so all being well and no show stoppers are found, September 20th is when we will plan to make the full v3 release.

As always, be sure to follow us on Twitter or join our mailing list to stay up to date on the latest announcements.

 

Thanks for reading,

Team Vendr.