• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

connorivy / beamOS / 14882999397

07 May 2025 12:10PM UTC coverage: 70.971%. First build
14882999397

Pull #85

github

web-flow
Merge 16abd45d8 into e6bb4b15c
Pull Request #85: Add load combos

867 of 1830 branches covered (47.38%)

Branch coverage included in aggregate %.

1474 of 1639 new or added lines in 74 files covered. (89.93%)

7536 of 10010 relevant lines covered (75.28%)

0.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

64.8
/src/StructuralAnalysis/BeamOs.StructuralAnalysis.Infrastructure/DependencyInjection.cs
1
using BeamOs.Common.Application;
2
using BeamOs.Identity;
3
using BeamOs.StructuralAnalysis.Application.AnalyticalResults.NodeResults;
4
using BeamOs.StructuralAnalysis.Application.AnalyticalResults.ResultSets;
5
using BeamOs.StructuralAnalysis.Application.Common;
6
using BeamOs.StructuralAnalysis.Application.PhysicalModel.Element1ds;
7
using BeamOs.StructuralAnalysis.Application.PhysicalModel.LoadCases;
8
using BeamOs.StructuralAnalysis.Application.PhysicalModel.LoadCombinations;
9
using BeamOs.StructuralAnalysis.Application.PhysicalModel.Materials;
10
using BeamOs.StructuralAnalysis.Application.PhysicalModel.Models;
11
using BeamOs.StructuralAnalysis.Application.PhysicalModel.MomentLoads;
12
using BeamOs.StructuralAnalysis.Application.PhysicalModel.Nodes;
13
using BeamOs.StructuralAnalysis.Application.PhysicalModel.PointLoads;
14
using BeamOs.StructuralAnalysis.Application.PhysicalModel.SectionProfiles;
15
using BeamOs.StructuralAnalysis.Contracts.PhysicalModel.Model;
16
using BeamOs.StructuralAnalysis.Domain.DirectStiffnessMethod;
17
using BeamOs.StructuralAnalysis.Infrastructure.AnalyticalResults.NodeResults;
18
using BeamOs.StructuralAnalysis.Infrastructure.AnalyticalResults.ResultSets;
19
using BeamOs.StructuralAnalysis.Infrastructure.Common;
20
using BeamOs.StructuralAnalysis.Infrastructure.PhysicalModel.Element1ds;
21
using BeamOs.StructuralAnalysis.Infrastructure.PhysicalModel.LoadCases;
22
using BeamOs.StructuralAnalysis.Infrastructure.PhysicalModel.LoadCombinations;
23
using BeamOs.StructuralAnalysis.Infrastructure.PhysicalModel.Materials;
24
using BeamOs.StructuralAnalysis.Infrastructure.PhysicalModel.Models;
25
using BeamOs.StructuralAnalysis.Infrastructure.PhysicalModel.MomentLoads;
26
using BeamOs.StructuralAnalysis.Infrastructure.PhysicalModel.Nodes;
27
using BeamOs.StructuralAnalysis.Infrastructure.PhysicalModel.PointLoads;
28
using BeamOs.StructuralAnalysis.Infrastructure.PhysicalModel.SectionProfiles;
29
using BeamOs.Tests.Common;
30
using MathNet.Numerics.Providers.SparseSolver;
31
using Microsoft.EntityFrameworkCore;
32
using Microsoft.EntityFrameworkCore.Diagnostics;
33
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
34
using Microsoft.Extensions.DependencyInjection;
35
using Microsoft.Extensions.Logging;
36

37
namespace BeamOs.StructuralAnalysis.Infrastructure;
38

39
public static class DependencyInjection
40
{
41
    public static IServiceCollection AddStructuralAnalysisInfrastructureRequired(
42
        this IServiceCollection services
43
    )
44
    {
2✔
45
        _ = services.AddScoped<INodeRepository, NodeRepository>();
2✔
46
        _ = services.AddScoped<IModelRepository, ModelRepository>();
2✔
47
        _ = services.AddScoped<IMaterialRepository, MaterialRepository>();
2✔
48
        _ = services.AddScoped<ISectionProfileRepository, SectionProfileRepository>();
2✔
49
        _ = services.AddScoped<IElement1dRepository, Element1dRepository>();
2✔
50
        _ = services.AddScoped<IPointLoadRepository, PointLoadRepository>();
2✔
51
        _ = services.AddScoped<IMomentLoadRepository, MomentLoadRepository>();
2✔
52
        _ = services.AddScoped<ILoadCaseRepository, LoadCaseRepository>();
2✔
53
        _ = services.AddScoped<ILoadCombinationRepository, LoadCombinationRepository>();
2✔
54
        _ = services.AddScoped<INodeResultRepository, NodeResultRepository>();
2✔
55
        _ = services.AddScoped<IResultSetRepository, ResultSetRepository>();
2✔
56

57
        _ = services.AddScoped<IStructuralAnalysisUnitOfWork, UnitOfWork>();
2✔
58

59
        services.AddObjectThatImplementInterface<IAssemblyMarkerInfrastructure>(
2✔
60
            typeof(IQueryHandler<,>),
2✔
61
            ServiceLifetime.Scoped,
2✔
62
            false
2✔
63
        );
2✔
64

65
        return services;
2✔
66
    }
2✔
67

68
    public static IServiceCollection AddStructuralAnalysisInfrastructureConfigurable(
69
        this IServiceCollection services,
70
        string connectionString
71
    )
72
    {
2✔
73
        services.AddSingleton(TimeProvider.System);
2✔
74

75
        _ = services.AddDbContext<StructuralAnalysisDbContext>(options =>
2✔
76
        {
×
77
            options
×
NEW
78
                .UseNpgsql(
×
NEW
79
                    connectionString,
×
NEW
80
                    o => o.MigrationsAssembly(typeof(IAssemblyMarkerInfrastructure).Assembly)
×
NEW
81
                )
×
82
                .AddInterceptors(
×
NEW
83
                    // new ModelEntityIdIncrementingInterceptor(),
×
84
                    new ModelLastModifiedUpdater(TimeProvider.System)
×
NEW
85
                )
×
NEW
86
#if !DEBUG
×
NEW
87
                .UseLoggerFactory(
×
NEW
88
                    LoggerFactory.Create(builder =>
×
NEW
89
                    {
×
NEW
90
                        builder.AddFilter((category, level) => level >= LogLevel.Error);
×
NEW
91
                    })
×
NEW
92
                )
×
NEW
93
#endif
×
NEW
94
                .ConfigureWarnings(warnings =>
×
NEW
95
                {
×
NEW
96
                    warnings.Log(RelationalEventId.PendingModelChangesWarning);
×
NEW
97
                });
×
98
        });
×
99

100
        services.AddScoped<IUserIdProvider, UserIdProvider>();
2✔
101

102
        services.AddScoped<
2✔
103
            IQueryHandler<EmptyRequest, List<ModelInfoResponse>>,
2✔
104
            GetModelsQueryHandler
2✔
105
        >();
2✔
106

107
        if (BeamOsEnv.IsCiEnv())
2!
108
        {
2✔
109
            services.AddSingleton<ISolverFactory, CholeskySolverFactory>();
2✔
110
        }
2✔
111
        else
112
        {
×
113
            services.AddSingleton<ISolverFactory, PardisoSolverFactory>();
×
114
        }
×
115

116
        return services;
2✔
117
    }
2✔
118

119
    public static void AddPhysicalModelInfrastructure(
120
        this ModelConfigurationBuilder configurationBuilder
121
    )
122
    {
2✔
123
        configurationBuilder.AddValueConverters<IAssemblyMarkerInfrastructure>();
2✔
124
    }
2✔
125

126
    public static void AddValueConverters<TAssemblyMarker>(
127
        this ModelConfigurationBuilder configurationBuilder
128
    )
129
    {
2✔
130
        var valueConverters = typeof(TAssemblyMarker)
2✔
131
            .Assembly.GetTypes()
2✔
132
            .Where(t =>
2✔
133
                t.IsClass
2✔
134
                && t.BaseType is not null
2✔
135
                && t.BaseType.IsGenericType
2✔
136
                && t.BaseType.GetGenericTypeDefinition() == typeof(ValueConverter<,>)
2✔
137
            );
2✔
138

139
        foreach (var valueConverterType in valueConverters)
2✔
140
        {
2✔
141
            var genericArgs = valueConverterType.BaseType?.GetGenericArguments();
2!
142
            if (genericArgs?.Length != 2)
2!
143
            {
×
144
                throw new ArgumentException();
×
145
            }
146

147
            _ = configurationBuilder.Properties(genericArgs[0]).HaveConversion(valueConverterType);
2✔
148
        }
2✔
149
    }
2✔
150
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc