Unity BootStrapper utilizing Microsoft's Enterprise Library, Prism, and Nuget
E.DIN Editor • May 20, 2015
// NOTE: Unity BootStrapper utilizing Microsoft's Enterprise Library Exception Handling & Prism via Nuget Libraries
// NOTE: The AuthenticateUser is required during loading, in this case, in order to load primary service interfaces
//NOTE** CallbackLogger is used only for custom error handling during bootstrap loading
}
protected override void InitializeShell()
{
Application.Current.MainWindow = (ShellView) Shell;
Application.Current.MainWindow.Show();
}
public void ShowErrorWindow(string errorMsg)
{
Application.Current.MainWindow = new ErrorWindow(errorMsg);
Application.Current.MainWindow.Show();
}
protected override IModuleCatalog CreateModuleCatalog()
{
//NOTE** set the prism catalog directory to the root of the deployed executable
var moduleCatalog = new DirectoryModuleCatalog {ModulePath = @"."};
return moduleCatalog;
}
protected override ILoggerFacade CreateLogger()
{
return new EnterpriseLibraryLoggerAdapter();
}
protected override void ConfigureContainer()
{
//NOTE** Calling this first to log any unhandled errors during Bootstrapper load
Container.RegisterInstance(m_callBackLogger);
//NOTE** singleton objects
Container.RegisterInstance
Container.RegisterInstance
//NOTE** SINGLETON CHECKING STATEMENT
//bool singleton = ReferenceEquals(Container.Resolve
Container.RegisterType
Container.RegisterType
Container.RegisterType
Container.RegisterType
Container.RegisterType
Container.RegisterType
Container.RegisterType
Container.RegisterType
//NOTE** Call Exception Handling Block after the log is created in the Prism Bootstrapper
BootstrapExceptionHandlingBlock();
//NOTE** Container is required to register variant Prism infrastructure services
base.ConfigureContainer();
//NOTE** TEST CASE FOR UNHANDLED EXCEPTION HERE using the CallbackLogger >>
// throw new Exception("TESTING BOOTSTRAPPER EXCEPTION");
}
protected override Microsoft.Practices.Prism.Regions.IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
{
var factory = base.ConfigureDefaultRegionBehaviors();
return factory;
}
private void BootstrapExceptionHandlingBlock()
{
Container.RegisterType
new InjectionConstructor(new List
{
new ExceptionPolicyDefinition(ExceptionCategory.DEFAULT, ConfigureDefaultPolicy()),
new ExceptionPolicyDefinition(ExceptionCategory.DATA, ConfigureDataPolicy()),
new ExceptionPolicyDefinition(ExceptionCategory.SERVICE, ConfigureServicePolicy()),
new ExceptionPolicyDefinition(ExceptionCategory.UI, ConfigureUiPolicy())
})
);
}
private static IEnumerable
{
var uiPolicyObject = new List
{
new ExceptionPolicyEntry(
typeof (Exception),
PostHandlingAction.ThrowNewException,
new IExceptionHandler[]
{
new LoggingExceptionHandler(
"Error",
100,
TraceEventType.Error,
"UI Error",
0,
typeof (TextExceptionFormatter),
Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Writer)
})
};
return uiPolicyObject;
}
private static IEnumerable
{
var servicePolicyObject = new List
{
new ExceptionPolicyEntry(
typeof (Exception),
PostHandlingAction.ThrowNewException,
new IExceptionHandler[]
{
new LoggingExceptionHandler(
"Error",
100,
TraceEventType.Error,
"Service Error",
0,
typeof (TextExceptionFormatter),
Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Writer)
})
};
return servicePolicyObject;
}
private static IEnumerable
{
var dataPolicyObject = new List
{
new ExceptionPolicyEntry(
typeof (Exception),
PostHandlingAction.None,
new IExceptionHandler[]
{
new LoggingExceptionHandler(
"Error",
100,
TraceEventType.Error,
"Default Error",
0,
typeof (TextExceptionFormatter),
Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Writer)
})
};
return dataPolicyObject;
}
private static IEnumerable
{
var dataPolicyObject = new List
{
new ExceptionPolicyEntry(
typeof (Exception),
PostHandlingAction.ThrowNewException,
new IExceptionHandler[]
{
new LoggingExceptionHandler(
"Critical",
100,
TraceEventType.Critical,
"Data Error",
0,
typeof (TextExceptionFormatter),
Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Writer)
})
};
return dataPolicyObject;
}
public void ExitApplication()
{
Application.Current.Shutdown();
}
}
}
Title: Base64 Encoding With Simple Salt (and decoding)
XPCMD_SHELL Move & Load Data from Directory
***** My Valid Data Monitor **** XML OUT *** HTML EMAIL DELIVERY *****IF OBJECT_ID('tempdb..#tCustomerID') IS NOT NULL DROP TABLE #tCustomerID select distinct mm.CustomerID Into #tCustomerID from myDatabase..myTable (nolock) mm left join myDatabase.dbo.myOtherTable (nolock) mo on mm.refID = mo.id left join myDatabase.dbo.myOtherTableDetail (nolock) mod on mo.id = mod.myOtherTableid and mm.SearchValue = mod.SearchValue where mm.refID is not null and mm.quantity is not null and mod.SearchValue is nullIF Exists (Select 1 From #tCustomerID)BEGIN DECLARE @xml NVARCHAR(MAX)DECLARE @body NVARCHAR(MAX)SET @xml = CAST(( SELECT [CustomerID] AS 'td' FROM #tCustomerID ORDER BY CustomerID FOR XML PATH('tr'), ELEMENTS ) AS NVARCHAR(MAX))SET @body ='
'--SELECT @body exec msdb.dbo.sp_send_dbmail @profile_name = 'dbmailProfile' ,@recipients = 'usergroup@mydomain.com' ,@subject = 'My Valid Data Monitor' ,@body = @body ,@body_format = 'HTML'END
My Valid Data Monitor
CustomerID |
---|
Turn Up! Not every microphone has the same base volume for transmitting your voice through your computer to whoever or whatever is on the other end of the exchange. Some microphones have a higher volume as compared to others, and some microphones have a volume that is so low that the person on the other […]
The post How to Turn Up Mic Volume in Windows 10 – Appuals.com appeared first on TekPreacher.
'+@UNCPathAndLogTable+'