コード例 #1
0
 /// <inheritdoc />
 public NonDomainEntityRepository(AsmContext context)
 {
     Context = context;
     if (typeof(T).IsSubclassOf(typeof(DomainEntity)))
     {
         throw new ArgumentException($"Type of T has inherited from {nameof(DomainEntity)} which is not allowed in {nameof(NonDomainEntityRepository<T>)}");
     }
 }
コード例 #2
0
        /// <summary>
        /// Creates an in memory database
        /// As long as database stays alive, it will retain state for the given name
        /// </summary>
        /// <param name="inMemoryDatabaseName">The name of the in memory database</param>
        /// <param name="ensureSeeded"></param>
        /// <param name="dummyData">Optional <see cref="DummyData"/> instance</param>
        /// <returns></returns>
        public static AsmContext GetEvaluatorContextContext(string inMemoryDatabaseName, bool ensureSeeded = true, DummyData dummyData = null)
        {
            DbContextOptions <AsmContext> options = new DbContextOptionsBuilder <AsmContext>()
                                                    .UseInMemoryDatabase(inMemoryDatabaseName)
                                                    .Options;
            var context = new AsmContext(options);

            if (ensureSeeded)
            {
                context.EnsureSeeded(dummyData);
            }
            return(context);
        }
コード例 #3
0
 protected DomainEntityRepository(AsmContext context)
 {
     Context = context;
 }