Projekt

Obecné

Profil

« Předchozí | Další » 

Revize ea9391d6

Přidáno uživatelem Milan Hotovec před téměř 4 roky(ů)

Added registrars
refs #8555 @2h
@testFull

Zobrazit rozdíly:

src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/Comment.cs
15 15

  
16 16
        }
17 17

  
18
        public Comment(DomainUser creator, Goal goal, string text, bool isPrivate)
18
        public Comment(DomainUser creator, GoalItem goal, string text, bool isPrivate)
19 19
        {
20 20
            this.Creator = creator;
21 21
            this.CreatorId = creator.UserId;
......
28 28
        public Guid Id { get; private set; }
29 29
        public DomainUser Creator { get; private set; }
30 30
        public Guid CreatorId { get; private set; }
31
        public Goal Goal { get; private set; }
31
        public GoalItem Goal { get; private set; }
32 32
        public Guid GoalId { get; private set; }
33 33
        public string Text { get; private set; }
34 34
        public bool IsPrivate { get; private set; }
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/Goal.cs
1
using Leuze.Core.Domain.Domains;
2
using Leuze.Core.Domain.Domains.Users;
3
using System;
4
using System.Collections.Generic;
5
using System.Linq;
6
using System.Text;
7
using System.Threading.Tasks;
8

  
9
namespace Leuze.Modules.Goal.Domain.Domains
10
{
11
    public class Goal : BaseEntity
12
    {
13
        private Goal()
14
        {
15

  
16
        }
17

  
18
        public Goal(GoalDefinition goalDefinition, DomainUser creator, string name, string description)
19
        {
20
            this.GoalDefinition = goalDefinition;
21
            this.GoalDefinitionId = goalDefinition.Id;
22
            this.Creator = creator;
23
            this.CreatorId = creator.UserId;
24
            this.Name = name;
25
            this.Description = description;
26
        }
27

  
28
        public Guid Id { get; private set; }
29
        public GoalDefinition GoalDefinition { get; private set; }
30
        public Guid GoalDefinitionId { get; private set; }
31
        public DomainUser Creator { get; private set; }
32
        public Guid CreatorId { get; private set; }
33
        public string Name { get; private set; }
34
        public string Description { get; private set; }
35
        public int PercentileUser { get; private set; }
36
        public int PercentileFinal { get; private set; }
37
    }
38
}
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GoalDefinition.cs
36 36
        public DateTime From { get; private set; }
37 37
        public DateTime To { get; private set; }
38 38
        public decimal Vari { get; private set; }
39

  
40
        private List<GoalItem> _goals { get; set; }
41
        public IReadOnlyList<GoalItem> Goals => _goals.AsReadOnly();
39 42
    }
40 43
}
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GoalItem.cs
1
using Leuze.Core.Domain.Domains;
2
using Leuze.Core.Domain.Domains.Users;
3
using System;
4
using System.Collections.Generic;
5
using System.Linq;
6
using System.Text;
7
using System.Threading.Tasks;
8

  
9
namespace Leuze.Modules.Goal.Domain.Domains
10
{
11
    public class GoalItem : BaseEntity
12
    {
13
        private GoalItem()
14
        {
15

  
16
        }
17

  
18
        public GoalItem(GoalDefinition goalDefinition, DomainUser creator, string name, string description)
19
        {
20
            this.GoalDefinition = goalDefinition;
21
            this.GoalDefinitionId = goalDefinition.Id;
22
            this.Creator = creator;
23
            this.CreatorId = creator.UserId;
24
            this.Name = name;
25
            this.Description = description;
26
        }
27

  
28
        public Guid Id { get; private set; }
29
        public GoalDefinition GoalDefinition { get; private set; }
30
        public Guid GoalDefinitionId { get; private set; }
31
        public DomainUser Creator { get; private set; }
32
        public Guid CreatorId { get; private set; }
33
        public string Name { get; private set; }
34
        public string Description { get; private set; }
35
        public int PercentileUser { get; private set; }
36
        public int PercentileFinal { get; private set; }
37

  
38
        private List<Comment> _comments { get; set; }
39
        public IReadOnlyList<Comment> Comments => _comments.AsReadOnly();
40

  
41
        private List<GoalUpdate> _updates { get; set; }
42
        public IReadOnlyList<GoalUpdate> Updates => _updates.AsReadOnly();
43

  
44
        private List<Review> _reviews { get; set; }
45
        public IReadOnlyList<Review> Reviews => _reviews.AsReadOnly();
46
    }
47
}
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/GoalUpdate.cs
15 15

  
16 16
        }
17 17

  
18
        public GoalUpdate(DomainUser creator, Goal goal, UpdateType updatedType, string oldValue, string newValue)
18
        public GoalUpdate(DomainUser creator, GoalItem goal, UpdateType updatedType, string oldValue, string newValue)
19 19
        {
20 20
            this.Creator = creator;
21 21
            this.CreatorId = creator.UserId;
......
29 29
        public Guid Id { get; private set; }
30 30
        public DomainUser Creator { get; private set; }
31 31
        public Guid CreatorId { get; private set; }
32
        public Goal Goal { get; private set; }
32
        public GoalItem Goal { get; private set; }
33 33
        public Guid GoalId { get; private set; }
34 34
        public UpdateType UpdatedType { get; private set; }
35 35
        public string OldValue { get; private set; }
src/Modules/Goal/Domain/Leuze.Modules.Goal.Domain/Domains/Review.cs
15 15

  
16 16
        }
17 17

  
18
        public Review(DomainUser creator, Goal goal, string commentCreator, string commentOwner, bool isFinal)
18
        public Review(DomainUser creator, GoalItem goal, string commentCreator, string commentOwner, bool isFinal)
19 19
        {
20 20
            this.Creator = creator;
21 21
            this.CreatorId = creator.UserId;
......
29 29
        public Guid Id { get; private set; }
30 30
        public DomainUser Creator { get; private set; }
31 31
        public Guid CreatorId { get; private set; }
32
        public Goal Goal { get; private set; }
32
        public GoalItem Goal { get; private set; }
33 33
        public Guid GoalId { get; private set; }
34 34
        public string CommentOwner { get; private set; }
35 35
        public string CommentCreator { get; private set; }
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Registrars/CommentRegistrar.cs
1
using ExtCore.Data.EntityFramework;
2
using Leuze.Modules.Goal.Domain.Domains;
3
using Microsoft.EntityFrameworkCore;
4
using System;
5
using System.Collections.Generic;
6
using System.Linq;
7
using System.Text;
8
using System.Threading.Tasks;
9

  
10
namespace Leuze.Modules.Goal.Infrastructure.Persistence.Registrars
11
{
12
    public class CommentRegistrar : IEntityRegistrar
13
    {
14
        public void RegisterEntities(ModelBuilder modelbuilder)
15
        {
16
            modelbuilder.Entity<Comment>(etb =>
17
            {
18
                etb.HasKey(e => e.Id);
19
                etb.Property(e => e.Id).ValueGeneratedOnAdd();
20
                etb.HasOne(e => e.Creator).WithMany().HasForeignKey(e => e.CreatorId);
21
                etb.HasOne(e => e.Goal).WithMany(e => e.Comments).HasForeignKey(e => e.GoalId);
22
                etb.Property(e => e.Text).IsRequired();
23

  
24
                etb.ToTable("Leuze_Modules_Goal_Domain_Comments");
25
            });
26
        }
27
    }
28
}
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Registrars/GoalDefinitionRegistrar.cs
1
using ExtCore.Data.EntityFramework;
2
using Leuze.Modules.Goal.Domain.Domains;
3
using Microsoft.EntityFrameworkCore;
4
using System;
5
using System.Collections.Generic;
6
using System.Linq;
7
using System.Text;
8
using System.Threading.Tasks;
9

  
10
namespace Leuze.Modules.Goal.Infrastructure.Persistence.Registrars
11
{
12
    public class GoalDefinitionRegistrar : IEntityRegistrar
13
    {
14
        public void RegisterEntities(ModelBuilder modelbuilder)
15
        {
16
            modelbuilder.Entity<GoalDefinition>(etb =>
17
            {
18
                etb.HasKey(e => e.Id);
19
                etb.Property(e => e.Id).ValueGeneratedOnAdd();
20
                etb.HasOne(e => e.Creator).WithMany().HasForeignKey(e => e.CreatorId);
21
                etb.HasOne(e => e.Owner).WithMany().HasForeignKey(e => e.OwnerId);
22
                etb.Property(e => e.Name).IsRequired().HasMaxLength(255);
23
                etb.Property(e => e.From).IsRequired();
24
                etb.Property(e => e.To).IsRequired();
25
                etb.Property(e => e.Vari).IsRequired(false);
26
                etb.HasMany(e => e.Goals).WithOne(e => e.GoalDefinition).HasForeignKey(e => e.GoalDefinitionId);
27

  
28

  
29
                etb.ToTable("Leuze_Modules_Goal_Domain_GoalDefinitions");
30
            });
31
        }
32
    }
33
}
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Registrars/GoalRegistrar.cs
1
using ExtCore.Data.EntityFramework;
2
using Leuze.Modules.Goal.Domain.Domains;
3
using Microsoft.EntityFrameworkCore;
4
using System;
5
using System.Collections.Generic;
6
using System.Linq;
7
using System.Text;
8
using System.Threading.Tasks;
9

  
10
namespace Leuze.Modules.Goal.Infrastructure.Persistence.Registrars
11
{
12
    public class GoalRegistrar : IEntityRegistrar
13
    {
14
        public void RegisterEntities(ModelBuilder modelbuilder)
15
        {
16
            modelbuilder.Entity<GoalItem>(etb =>
17
            {
18
                etb.HasKey(e => e.Id);
19
                etb.Property(e => e.Id).ValueGeneratedOnAdd();
20
                etb.HasOne(e => e.GoalDefinition).WithMany(e => e.Goals).HasForeignKey(e => e.GoalDefinitionId);
21
                etb.HasOne(e => e.Creator).WithMany().HasForeignKey(e => e.CreatorId);
22
                etb.Property(e => e.Name).IsRequired().HasMaxLength(255);
23
                etb.HasMany(e => e.Comments).WithOne(e => e.Goal).HasForeignKey(e => e.GoalId);
24
                etb.HasMany(e => e.Updates).WithOne(e => e.Goal).HasForeignKey(e => e.GoalId);
25
                etb.HasMany(e => e.Reviews).WithOne(e => e.Goal).HasForeignKey(e => e.GoalId);
26

  
27
                etb.ToTable("Leuze_Modules_Goal_Domain_GoalItems");
28
            });
29
        }
30
    }
31
}
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Registrars/GoalUpdateRegistrar.cs
1
using ExtCore.Data.EntityFramework;
2
using Leuze.Modules.Goal.Domain.Domains;
3
using Microsoft.EntityFrameworkCore;
4
using System;
5
using System.Collections.Generic;
6
using System.Linq;
7
using System.Text;
8
using System.Threading.Tasks;
9

  
10
namespace Leuze.Modules.Goal.Infrastructure.Persistence.Registrars
11
{
12
    public class GoalUpdateRegistrar : IEntityRegistrar
13
    {
14
        public void RegisterEntities(ModelBuilder modelbuilder)
15
        {
16
            modelbuilder.Entity<GoalUpdate>(etb =>
17
            {
18
                etb.HasKey(e => e.Id);
19
                etb.Property(e => e.Id).ValueGeneratedOnAdd();
20
                etb.HasOne(e => e.Creator).WithMany().HasForeignKey(e => e.CreatorId);
21
                etb.HasOne(e => e.Goal).WithMany(e => e.Updates).HasForeignKey(e => e.GoalId);
22
                etb.Property(e => e.UpdatedType).IsRequired();
23
                etb.Property(e => e.OldValue).IsRequired();
24
                etb.Property(e => e.NewValue).IsRequired();
25

  
26
                etb.ToTable("Leuze_Modules_Goal_Domain_GoalUpdates");
27
            });
28
        }
29
    }
30
}
src/Modules/Goal/Infrastructure/Leuze.Modules.Goal.Infrastructure.Persistence/Registrars/ReviewRegistrar.cs
1
using ExtCore.Data.EntityFramework;
2
using Leuze.Modules.Goal.Domain.Domains;
3
using Microsoft.EntityFrameworkCore;
4
using System;
5
using System.Collections.Generic;
6
using System.Linq;
7
using System.Text;
8
using System.Threading.Tasks;
9

  
10
namespace Leuze.Modules.Goal.Infrastructure.Persistence.Registrars
11
{
12
    public class ReviewRegistrar : IEntityRegistrar
13
    {
14
        public void RegisterEntities(ModelBuilder modelbuilder)
15
        {
16
            modelbuilder.Entity<Review>(etb =>
17
            {
18
                etb.HasKey(e => e.Id);
19
                etb.Property(e => e.Id).ValueGeneratedOnAdd();
20
                etb.HasOne(e => e.Creator).WithMany().HasForeignKey(e => e.CreatorId);
21
                etb.HasOne(e => e.Goal).WithMany(e => e.Reviews).HasForeignKey(e => e.GoalId);
22

  
23
                etb.ToTable("Leuze_Modules_Goal_Domain_Reviews");
24
            });
25
        }
26
    }
27
}

Také k dispozici: Unified diff