Entity Framework Core 2.0: data, mobile, server, IoT, and more
Rowan Miller

This session presented the new features brought by EF Core 2.0, which is out as Preview 1 right now.

Like .NET Core, EF Core is built against .NET Standard 2.0 which means that it can be used on any platform: Windows, Xamarin, HoloLens, IoT, Linux, etc.

Here’s the summary of the new features demonstrated

  • Global Query Filters
  • Flexible Mapping
  • Context Pooling
  • Compiled Queries
  • Some currently in development features were also shown like complex type mapping (which already exists in EF6) and better migration with « SeedData ».

    Global Query Filters allows to define filters at the DbContext level.
    For example in soft delete scenario, instead of excluding « IsDeleted = True » in every queries, we can define in the configuration of the DbContext to exclude it globally.
    This is done with the following code:

    modelBuilder.Entity<Blog>().HasQueryFilter(p => !p.IsDeleted)

    The interesting part of that line of code is that the QueryFilter part is evaluated at every query.
    This allows to do things like this.

    public class MyDbContext : DbContext
        public string TenantId {get; set; }
        public void OnConfigure(...)
            modelBuilder.Entity<Blog>().HasQueryFilter(b => b.TenantId == TenantId);

    Flexible Mapping allows more possibilities when mapping a C# object to a table.
    One possibility is mapping a private field to a column.


    When we want to retrieve the value of the column, we can write that line

    var value = EF.Property<string>(row, "TenantId")

    Context Pooling allows the use a pool of already instantiated DbContext (like a ThreadPool) when working with DI.
    Enabling it is pretty straightforward, just replace « .AddDbContext() » by « .AddDbContextPool() ».
    It has some restrictions because the DbContext needs to be cleaned before each use.

    Compiled Queries are now available in EF Core.

    var query = EF.CompiledQuery((DbContext dbContext, int id) => dbContext.Table.First(a => a.Id == id))
    var result = query(dbContext, id);

    During the session, the speaker demonstrated the « EF Everywhere » by running a UWP application with EF Core on a Raspberry Pi named « Unicorn Launcher » that launched a small rocket into the air.


    XAML custom controls for UWP: Start to finish
    John Bristowe, Nikola Metulev

    This was a disappointing session.
    I tried my chances with this session based on its description which promised to explain the best pratices and UX design patterns for accessibility and input methods (mouse, keyboard, game controller, HoloLens) when creating custom controls in XAML.

    But in fact, it was a plain simple session on how to use and create controls in XAML (that is the same thing since the introduction of WPF 10 years ago).

    This session was more of an advertisement for UWP Community Toolkit and UI for Telerik.

    Here’s what we saw

    • 1st party controls: Button, TextBox, etc.
    • 3rd party controls: UWP community toolkit, Telerik, etc.
    • Restyled controls (Style, Template)
    • Extended controls (Inheriting controls to add behaviors)
    • Custom controls

    Nextgen UWP app distribution: Building extensible, stream-able, componentized apps
    John Vintzel, Sandeep George

    This session talked about some new features for UWP concerning the distribution of the apps.

    First, we were shown the « App streaming installation » feature that allows to download only a « required » part of the application and run it even before its full download. This can be compared to how Xbox games can be partially downloaded and run.

    This is available right now in the Creators Update.

    All the magic lies in a manifest file named « AppxContentGroupMap.xml » that is included in the UWP app. The Windows Store then uses this file to know how to install it.
    This feature comes with all the needed API to finely manage how to application reacts to missing parts, prioritizes parts to download and gets feedback on the progression of the download.

    APIs are also available to debug the app to simulate a state of partial download.

    For more information, see https://aka.ms/uwpstreaminginstall

    Coming in the Fall Creators Update, optional packages for UWP will be available.
    We can see it as DLC or plugins for existing UWP apps.
    It extends an existing app (or many) by adding contents and/or features and it can be sold separately.
    A UWP app that allows for optional packages can also receive packages from other publishers.

    For more information, see https://aka.ms/uwpoptionalpackages

    Modernize WinForms and WPF apps with maximum code reuse, cross-platform reach, and efficient DevOps
    Joshua Weber, Mike Battista

    This session was also non-surprising.
    It was aimed at those stuck with WinForms/WPF and who didn’t followed the other technologies in the meantime.

    To start, we were explained how to leverage the Desktop Bridge to take advantage of all the new APIs of Windows 10.
    Then, by moving the codebase of an existing app to a .NET Standard 2.0 lib, the code was reused into a Xamarin app.
    To end this session, we were presented Visual Studio Mobile Center to setup CI/CD for the Xamarin app.