5.4 KiB
Steps to Add New WorkItem to Existing Setup Api
- Add new ActionType
a. Location: LCU.Library.Internal.DispatcherModels Library --> Enums namespace --> ActionType.cs class
b. Should add number the enum correlates to and to make sure to use the next number inline. - Update the API's Nuget version in LCU.Api.Internal.DispatcherSharedLib Library.
a. Right click on LCU.Api.Internal.DispatcherSharedLib Library and select Manage Nuget Packages.
b. Find API which will be updated.
c. Update - Add Configuration to API's Configuration Class
a. Location: LCU.Api.Internal.DispatcherSharedLib Library --> Configurations namespace--> ..Configuration.cs class
b. Add new Endpoint Property
c. Add NotMapped Url Property - Add new Endpoint to API's Configuration to Appsettings.
- Add new ActionService Build to switch.
a. Location: LCU.Api.Internal.DispatcherSharedLib Library --> BuilderServices namespace --> ActionBuilderService.cs class --> BuildAction method
b. Add to #region for API. Example #Region FileOperationsApi.
c. Add new switch following the existing switch's pattern. - Add new unit test to the ActionBuildServiceTest.
- Update Version/Description/PackageReleaseNotes LCU.Api.Internal.DispatcherSharedLib.
a. Increase by 0.0.1 for new WorkItems. - Update Version/Description/PackageReleaseNotes LCU.Library.Internal.DispatcherModels.
a. Increase by 0.0.1 for new ActionTypes. - Add new endpoint to Release Variables.
a. Set variable to be release.
Steps to Add New WorkItem to New API Setup
- Add new ActionType
a. Location: LCU.Library.Internal.DispatcherModels Library --> Enums namespace --> ActionType.cs class
b. Should add number the enum correlates to and to make sure to use the next number inline. - Install the new API's Nuget version in LCU.Api.Internal.DispatcherSharedLib Library.
a. Right click on LCU.Api.Internal.DispatcherSharedLib Library and select Manage Nuget Packages.
b. Find API which will be installed.
c. install - Create new Configurations class for new API
a. Location: LCU.Api.Internal.DispatcherSharedLib Library --> Configurations namespace--> ..Configuration.cs class
b. Add URL Property
c. Add New Endpoint Property
d. Add NotMapped URL Property that will be URL + Endpoint. Follow already existing Configration classes as example. - Add new Endpoint to API's Configuration to Appsettings.
- Bind New Configration Model in DependencyInjection.cs
a. Location: LCU.Api.Internal.DispatcherSharedLib --> DependencyInjection.cs - Add new ActionService Build to switch.
a. Location: LCU.Api.Internal.DispatcherSharedLib Library --> BuilderServices namespace --> ActionBuilderService.cs class --> BuildAction method
b. Pull in new Configration class.
c. Create new #region for API. Use #Region FileOperationsApi as an example.
d. Add new switch following the existing switch's pattern. - Add new Region for Api and new unit test to the ActionBuildServiceTest.
- Update Version/Description/PackageReleaseNotes LCU.Api.Internal.DispatcherSharedLib.
a. Increase by 0.0.1 for new WorkItems. - Update Version/Description/PackageReleaseNotes LCU.Library.Internal.DispatcherModels. Increase by 0.0.1 for new ActionTypes.
a. Increase by 0.0.1 for new ActionTypes. - Add new URL and new endpoint to Release Variables.
a. Set variable to be release.
b. Set each URL appropriately for each environment
Notes: - Only HttpMethodType.Post is set up to be used. - The model being added needs to have extend the ReturnResponse model - Will need to add the QueueReturnResponse.QueueResponse([Model]) to the API upon completion.
#Filter and Sorting Filtering and sorting are handled by creating IQueryable and IEnumarable classes/methods. IQueryable is the preferred route as it will utilize the power of the database querying rather than filtering/sorting after the data has been gathered. Only use IEnumarable if it is more complicated to write the linq statement then already written C# code.
Once a Filter Property and a IQueryable/IEnumarable class/method are created you will just need to append in the desired entities repository method in which is being filtered.
Adding Filtering Steps:
- Add new property to Filter model. Use another model if needed more information.
- Create IQueryable/IEnumarable classes/methods in the proper namespaces.
- Append new method to your context query call or after if using an IEnumarable.
- Test
Adding Sorting Steps:
- Add string constant
- Add string constant to list of constants.
Steps to setup local database
- Download and install Sql Server 2022 Developer edition
- Right click the LCU.Api.Internal.DispatcherSql project and select the Publish option
- Click Edit in the Target Database Connection Settings. Use the following settings: Server Name: localhost Authentication: Windows Authentication User Name: LCU\YOUR NAME (This should already be populated) Password: Database Name: master
- Test connection and ensure it was successful. Click Ok. The target database connection will now be populated.
- Enter Dispatcher for Database Name
- Enter LCU.Api.Internal.DispatcherSql.sql for Publish Script Name
- Click Publish. You now have a local sql server setup with the dispatcher database.
- You can download and install sql management studio to view database locally.