-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added command execution timeout configuration option for EF Core DbCo…
…ntext
- Loading branch information
Valdis Iljuconoks
committed
Nov 18, 2024
1 parent
c230c73
commit e862a62
Showing
11 changed files
with
134 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 19 additions & 18 deletions
37
src/Geta.Optimizely.ProductFeed/Repositories/FeedApplicationDbContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
// Copyright (c) Geta Digital. All rights reserved. | ||
// Licensed under Apache-2.0. See the LICENSE file in the project root for more information | ||
|
||
using System; | ||
using Geta.Optimizely.ProductFeed.Models; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
// TODO: test namespace change | ||
namespace Geta.Optimizely.GoogleProductFeed.Repositories | ||
{ | ||
public class FeedApplicationDbContext : DbContext | ||
{ | ||
private readonly string _connectionString; | ||
namespace Geta.Optimizely.GoogleProductFeed.Repositories; | ||
|
||
public FeedApplicationDbContext(string connectionString) | ||
{ | ||
_connectionString = connectionString; | ||
} | ||
public sealed class FeedApplicationDbContext : DbContext | ||
{ | ||
private readonly string _connectionString; | ||
|
||
public FeedApplicationDbContext(DbContextOptions options) : base(options) | ||
{ | ||
} | ||
public FeedApplicationDbContext(string connectionString, TimeSpan commandTimeout) | ||
{ | ||
_connectionString = connectionString; | ||
Database.SetCommandTimeout(commandTimeout); | ||
} | ||
|
||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | ||
{ | ||
if (optionsBuilder.IsConfigured) return; | ||
public FeedApplicationDbContext(DbContextOptions options) : base(options) | ||
{ | ||
} | ||
|
||
optionsBuilder.UseSqlServer(_connectionString); | ||
} | ||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | ||
{ | ||
if (optionsBuilder.IsConfigured) return; | ||
|
||
public DbSet<FeedEntity> FeedData { get; set; } | ||
optionsBuilder.UseSqlServer(_connectionString); | ||
} | ||
|
||
public DbSet<FeedEntity> FeedData { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters