Skip to content

Aims Legacy Connector Module

The Aims Legacy Connector Module provides a way to integrate other services with Aims LTS version.

The AimsLegacyConnectorModule provides materialized representations of ServiceOrders and Assets, the LegacyServiceOrder and LegacyAsset.

Currently, the LegacyServiceOrder includes:

  • ServiceOrderId
  • Status.
  • Title.
  • AssetId.
  • Asset.

And the LegacyAsset includes:

  • AssetId.
  • AmosComponentId.

How to use it

The main idea behind the AimsLegacyConnectorModule is that, when you create your own service, you can retrieve the LegacyServiceOrders from the Aims Legacy Database.

We need to depend on the AimsLegacyConnectorModule and also configure the DbContext where we want the Legacy Service Order entity added to. This is usually the only DbContext that you have, which is the one generated by the microservice template:

C#
public  class  MyServiceApplicationModule : SuiteAspNetApplicationModule 
{ 
 public  override  void  SetupModule(IModuleBuilder  builder)
 {
  builder.DependsOn<AimsLegacyConnectorModule, AimsLegacyConnectorModuleOptions>(opts =>
    {
        opts.SetDbContext<ApplicationDbContext>();
    });
 }
}

Then we need to add the connection string of the Aims Legacy Database on the appsettings.json of our Application

JSON
1
2
3
 "ConnectionStrings": {
        "AimsLegacyConnection": "Data Source = aims.db"
    }

Finally we can create the IRepositories as follows:

csharp IReadOnlyRepository<long, LegacyServiceOrder> serviceOrderRepository; IReadOnlyRepository<long, LegacyAsset> assetRepository;

These IReadOnlyRepositories allow us to query data from Aims Legacy Database.