File tree Expand file tree Collapse file tree 6 files changed +12
-10
lines changed
SimpleTaskSystem.EntityFramework/EntityFramework
SimpleTaskSystem.NHibernate
SimpleTaskSystem.WebSpaAngular
SimpleTaskSystem.WebSpaDurandal Expand file tree Collapse file tree 6 files changed +12
-10
lines changed Original file line number Diff line number Diff line change 1
- using Abp . Domain . Entities ;
1
+ using System . ComponentModel . DataAnnotations . Schema ;
2
+ using Abp . Domain . Entities ;
2
3
3
4
namespace SimpleTaskSystem . People
4
5
{
@@ -7,6 +8,7 @@ namespace SimpleTaskSystem.People
7
8
///
8
9
/// It inherits from <see cref="Entity"/> class (Optionally can implement <see cref="IEntity"/> directly).
9
10
/// </summary>
11
+ [ Table ( "StsPeople" ) ]
10
12
public class Person : Entity
11
13
{
12
14
/// <summary>
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ namespace SimpleTaskSystem.Tasks
17
17
/// Implements <see cref="IHasCreationTime"/>, thus ABP sets CreationTime automatically while saving to database.
18
18
/// Also, this helps us to use standard naming and functionality for 'creation time' of entities.
19
19
/// </summary>
20
+ [ Table ( "StsTasks" ) ]
20
21
public class Task : Entity < long > , IHasCreationTime
21
22
{
22
23
/// <summary>
Original file line number Diff line number Diff line change @@ -8,20 +8,19 @@ namespace SimpleTaskSystem.EntityFramework
8
8
public class SimpleTaskSystemDbContext : AbpDbContext
9
9
{
10
10
public virtual IDbSet < Task > Tasks { get ; set ; }
11
+
11
12
public virtual IDbSet < Person > People { get ; set ; }
12
13
13
14
public SimpleTaskSystemDbContext ( )
14
- : base ( "MainDb " )
15
+ : base ( "Default " )
15
16
{
16
17
17
18
}
18
19
19
- protected override void OnModelCreating ( DbModelBuilder modelBuilder )
20
+ public SimpleTaskSystemDbContext ( string nameOrConnectionString )
21
+ : base ( nameOrConnectionString )
20
22
{
21
- base . OnModelCreating ( modelBuilder ) ;
22
-
23
- modelBuilder . Entity < Person > ( ) . ToTable ( "StsPeople" ) ;
24
- modelBuilder . Entity < Task > ( ) . ToTable ( "StsTasks" ) . HasOptional ( t => t . AssignedPerson ) ;
23
+
25
24
}
26
25
}
27
26
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ public class SimpleTaskSystemDataModule : AbpModule
11
11
{
12
12
public override void PreInitialize ( )
13
13
{
14
- var connStr = ConfigurationManager . ConnectionStrings [ "MainDb " ] . ConnectionString ;
14
+ var connStr = ConfigurationManager . ConnectionStrings [ "Default " ] . ConnectionString ;
15
15
Configuration . Modules . AbpNHibernate ( ) . FluentConfiguration
16
16
. Database ( MsSqlConfiguration . MsSql2008 . ConnectionString ( connStr ) )
17
17
. Mappings ( m => m . FluentMappings . AddFromAssembly ( Assembly . GetExecutingAssembly ( ) ) ) ;
Original file line number Diff line number Diff line change 20
20
<add key =" UnobtrusiveJavaScriptEnabled" value =" true" />
21
21
</appSettings >
22
22
<connectionStrings >
23
- <add name =" MainDb " connectionString =" Server=localhost; Database=SimpleTaskSystemDb; Trusted_Connection=True;" providerName =" System.Data.SqlClient" />
23
+ <add name =" Default " connectionString =" Server=localhost; Database=SimpleTaskSystemDb; Trusted_Connection=True;" providerName =" System.Data.SqlClient" />
24
24
</connectionStrings >
25
25
<system .web>
26
26
<globalization culture =" auto" uiCulture =" auto" />
Original file line number Diff line number Diff line change 11
11
<add key =" UnobtrusiveJavaScriptEnabled" value =" true" />
12
12
</appSettings >
13
13
<connectionStrings >
14
- <add name =" MainDb " connectionString =" Server=localhost; Database=SimpleTaskSystemDb; Trusted_Connection=True;" />
14
+ <add name =" Default " connectionString =" Server=localhost; Database=SimpleTaskSystemDb; Trusted_Connection=True;" />
15
15
</connectionStrings >
16
16
<system .web>
17
17
<globalization culture =" auto" uiCulture =" auto" />
You can’t perform that action at this time.
0 commit comments