-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathOracleContext.cs
More file actions
72 lines (59 loc) · 2.71 KB
/
OracleContext.cs
File metadata and controls
72 lines (59 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Oracle.EntityFrameworkCore.Infrastructure;
using WorkflowCore.Persistence.EntityFramework.Models;
using WorkflowCore.Persistence.EntityFramework.Services;
namespace WorkflowCore.Persistence.Oracle
{
public class OracleContext : WorkflowDbContext
{
private readonly string _connectionString;
private readonly Action<OracleDbContextOptionsBuilder> _oracleOptionsAction;
public OracleContext(string connectionString, Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null)
{
_connectionString = connectionString;
_oracleOptionsAction = oracleOptionsAction;
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
optionsBuilder.UseOracle(_connectionString, _oracleOptionsAction);
}
protected override void ConfigureSubscriptionStorage(EntityTypeBuilder<PersistedSubscription> builder)
{
builder.ToTable("Subscription");
builder.Property(x => x.PersistenceId).ValueGeneratedOnAdd();
}
protected override void ConfigureWorkflowStorage(EntityTypeBuilder<PersistedWorkflow> builder)
{
builder.ToTable("Workflow");
builder.Property(x => x.PersistenceId).ValueGeneratedOnAdd();
}
protected override void ConfigureExecutionPointerStorage(EntityTypeBuilder<PersistedExecutionPointer> builder)
{
builder.ToTable("ExecutionPointer");
builder.Property(x => x.PersistenceId).ValueGeneratedOnAdd();
}
protected override void ConfigureExecutionErrorStorage(EntityTypeBuilder<PersistedExecutionError> builder)
{
builder.ToTable("ExecutionError");
builder.Property(x => x.PersistenceId).ValueGeneratedOnAdd();
}
protected override void ConfigureExetensionAttributeStorage(EntityTypeBuilder<PersistedExtensionAttribute> builder)
{
builder.ToTable("ExtensionAttribute");
builder.Property(x => x.PersistenceId).ValueGeneratedOnAdd();
}
protected override void ConfigureEventStorage(EntityTypeBuilder<PersistedEvent> builder)
{
builder.ToTable("Event");
builder.Property(x => x.PersistenceId).ValueGeneratedOnAdd();
}
protected override void ConfigureScheduledCommandStorage(EntityTypeBuilder<PersistedScheduledCommand> builder)
{
builder.ToTable("ScheduledCommand");
builder.Property(x => x.PersistenceId).ValueGeneratedOnAdd();
}
}
}