Custom Execution Strategy Error in VS2017 and Entity framework Core 2.0

c# entity-framework entity-framework-core visual-studio visual-studio-2017

Question

I'm struggling to understand "Building Web Applications with Visual Studio 2017" by Philip Japikse, Kevin Grossnicklaus, and Ben Dewey. Entity Framework Core gives me error CR0246 when I attempt to build a class for a custom execution strategy: "The type or namespace name 'ExecutionStrategyContext' could not be identified (are you missing a using directive or assembly reference?)"

Only System and Microsoft.EntityFrameworkCore.Storage are listed as necessary references in the text. The content seems to match the documentation for EF Core 2.0, but I am unable to make the problem go away.

Note that I am using 2.0 whereas the book uses Core and EF 1.1. However, I can find no indication in any documentation that this is the problem. The subject is:

using System;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore;

namespace SpyStore.DAL.EF
{
    public class MyExecutionStrategy : ExecutionStrategy
    {
        public MyExecutionStrategy(ExecutionStrategyContext context) :
            base(context, ExecutionStrategy.DefaultMaxRetryCount, ExecutionStrategy.DefaultMaxDelay)
        {

        }

        public MyExecutionStrategy(ExecutionStrategyContext context, int maxRetryCount, TimeSpan maxRetryDelay) :
            base(context, maxRetryCount, maxRetryDelay)
        {

        }

        protected override bool ShouldRetryOn(Exception exception)
        {
            return true;
        }
    }
}

The problem is being highlighted by VS2017 in both instances of ExecutionStrategyContext. My first parameter is context, so I've tried changing them to simply "ExecutionStrategy context" instead of "ExecutionStrategyContext context," but I'm not sure if this is what I want and I still get an error. We appreciate any assistance! Thanks!

1
4
9/9/2017 11:41:31 PM

Accepted Answer

ZZZ_tmp
7
9/9/2017 11:31:15 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow