083 Preparing the Lookup resource application to run - chempkovsky/CS82ANGULAR GitHub Wiki
- Since, it's a demo project, we did not create separate WebApi app for the
PhbkEmployeeViewLookup resource services, though it is highly recommended.- instead, we created a separate Dbcontext for the
PhbkEmployeeViewLookup resource - instead, we created a separate consumer
- instead, we will create a separate copy of the Service Bus in the
LpPhBkWebApp-app with a separate section in theappsettings.json.
- instead, we created a separate Dbcontext for the
- Having three "instead", it'll be very easy to migrate to the separate WebApi app for the
PhbkEmployeeViewLookup resource services.- What projects need to be created was described in the article 034 CREATING LOOKUP RESOURCE PROJECTS
- Detailed comments about configuration have already been made in the article 46
- We do not describe step by step instructions in this article
- the only information summary will be presented
-
the following elements must be added to the
appsettings.jsonfile- connection string for the
LpEmpPhBkContextdbcontext -
PhbkEmployeeViewExtForLkUpConf-section to configure second instance of the Service Bus
- connection string for the
-
We introduce
ConnectionStrings:LpEmpPhBkConnection-item to configureLpEmpPhBkContext-DbContext
Click to show the code
"ConnectionStrings": {
"LpPhnPhBkConnection": "Data Source=SVR2016SQL2017;Initial Catalog=LpPhnPhBkDbDef;Persist Security Info=True;User ID=sa;Password=your_password_heer",
"LpEmpPhBkConnection": "Data Source=SVR2016SQL2017;Initial Catalog=LpEmpPhBkDbDef;Persist Security Info=True;User ID=sa;Password=your_password_heer",
"LpPhBkConnection": "Data Source=SVR2016SQL2017;Initial Catalog=LpPhBkDbDef;Persist Security Info=True;User ID=sa;Password=your_password_heer",
},- open
phbk-phone-view.extforlkup.interface.csmentioned in the article 077. In the end of the file you will find thePhbkPhoneViewExtForLkUpConf-class along with the instructions on how to use it
Click to show the code
/*
In appsettings.json it must be added the section like below.
1. If a RabbitMq cluster is present:
"PhbkPhoneViewExtForLkUpConf": {
"HostName ": "192.168.100.3",
"Username": "Admin",
"Password": "Admin",
"VirtualHostName": "phbkhost",
"ClusterIpAddresses": [
"192.168.100.4",
"192.168.100.5",
"192.168.100.6"
]
}
2. If a RabbitMq cluster is not present:
"PhbkPhoneViewExtForLkUpConf": {
"HostName ": "192.168.100.3",
"Username": "Admin",
"Password": "Admin",
"VirtualHostName": "phbkhost",
"ClusterIpAddresses": []
}
3. In the Program.cs file add the code like below:
var builder = WebApplication.CreateBuilder(args);
...
ConfigurationManager configuration = builder.Configuration;
...
var myOptions = new PhbkPhoneViewExtForLkUpConf();
configuration.GetSection(PhbkPhoneViewExtForLkUpConf.ConfName).Bind(myOptions);
...
*/
public class PhbkPhoneViewExtForLkUpConf {
public static string ConfName = "PhbkPhoneViewExtForLkUpConf";
public string HostName { get; set; } = String.Empty;
public string Username { get; set; } = String.Empty;
public string Password { get; set; } = String.Empty;
public string VirtualHostName { get; set; } = String.Empty;
public string[] ClusterIpAddresses { get; set; } = null!;
}- We will use the same RabbitMq server, Vhost, user as those desribed in the article 046. Thus, the
PhbkPhoneViewExtForLkUpConf-section will be identical to thePhbkDivisionViewExtForLkUpConf-section.
Click to show the code
"PhbkDivisionViewExtForLkUpConf": {
"HostName": "192.168.100.3",
"Username": "admin",
"Password": "admin",
"VirtualHostName": "phbkhost",
"ClusterIpAddresses": []
},
"PhbkEmployeeViewExtForLkUpConf": {
"HostName": "192.168.100.3",
"Username": "admin",
"Password": "admin",
"VirtualHostName": "phbkhost",
"ClusterIpAddresses": []
},
"PhbkPhoneViewExtForLkUpConf": {
"HostName": "192.168.100.3",
"Username": "admin",
"Password": "admin",
"VirtualHostName": "