Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private T CreateOrGetType<T, U>(string contract) where T : ClientBase<U>
- {
- var Exists = ClientCache.OfType<T>().FirstOrDefault();
- if (Exists != null) return Exists;
- var obj = (T)typeof(T).GetConstructor(new[] { typeof(string) }).Invoke(new object[] { contract });
- obj.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationManager.AppSettings["ServiceNow_UserName"].ToString();
- obj.ClientCredentials.UserName.Password = System.Configuration.ConfigurationManager.AppSettings["ServiceNow_Password"].ToString();
- ClientCache.Add(obj);
- return obj;
- }
- public ServiceNow.InsertChange.ServiceNowSoapClient CHG
- {
- get
- {
- return CreateOrGetType<ServiceNow.InsertChange.ServiceNowSoapClient, ServiceNow.InsertChange.ServiceNowSoap>("sn_insertchange");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement