This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LogInjectionModule : Module | |
{ | |
protected override void Load(ContainerBuilder builder) | |
{ | |
//log4net added by extension | |
log4net.Config.XmlConfigurator.Configure(); | |
builder.Register<ILogger>((c, p) => new Log4NetLog(p.TypedAs<Type>())); | |
} | |
protected override void AttachToComponentRegistration(IComponentRegistry registry, IComponentRegistration registration) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var stream = Assembly.GetExecutingAssembly() .GetManifestResourceStream("SalesForce.Tests.Required_AccountNames.txt")) | |
{ | |
using (var reader = new StreamReader(stream)) | |
{ | |
embededFile = reader.ReadToEnd(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); | |
config.AppSettings.Settings.Remove("CurrentUICulture"); | |
config.AppSettings.Settings.Add("CurrentUICulture", name); | |
config.Save(ConfigurationSaveMode.Modified, true); | |
// Force a reload of a changed section. | |
ConfigurationManager.RefreshSection("appSettings"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class RSAClass | |
{ | |
private static UnicodeEncoding _encoder = new UnicodeEncoding(); | |
public static string Decrypt(string data, string xmlPrivateKey) | |
{ | |
var rsa = new RSACryptoServiceProvider(); | |
var dataArray = data.Split(new char[] { ',' }); | |
var dataByte = new byte[dataArray.Length]; | |
for (int i = 0; i < dataArray.Length; i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var ctx = new Testctx(); | |
var usr = new User() {username = "bob"}; | |
ctx.Users.Add(usr); | |
ctx.SaveChanges(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ViewSelector : DataTemplateSelector | |
{ | |
public override DataTemplate SelectTemplate(object item, DependencyObject container) | |
{ | |
/* | |
<Window.Resources> | |
<Selectors:ViewSelector x:Key="ViewSelector"> | |
</Selectors:ViewSelector> | |
</Window.Resources> | |
<DockPanel Name="pnlDockMain" > |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ModuleBootstrapper | |
{ | |
public static string GetModuleTitle(IViewModel instance) | |
{ | |
var title = from a in instance.GetType().GetCustomAttributes(typeof(PublishedViewAttribute), false) | |
let pva = a as PublishedViewAttribute | |
select pva.Title; | |
return title.FirstOrDefault(); | |
} | |
public static Uri GetCurrentUICultureSource(string resourceName, Type containingModule) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(NS, $, undefined) { | |
//idea gleaned from https://gist.github.com/661855 | |
var o = $({}); | |
NS.Events = {}; | |
NS.Events.subscribe = function () { | |
console.log('Subscribing to ' + arguments[0]); | |
o.on.apply(o, arguments); | |
}; | |
NS.Events.unsubscribe = function () { | |
console.log('UnSubscribing from ' + arguments[0]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configSections> | |
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> | |
</configSections> | |
<log4net> | |
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> | |
<file value="log.txt" /> | |
<appendToFile value="true" /> | |
<rollingStyle value="Size" /> | |
<maxSizeRollBackups value="5" /> | |
<maximumFileSize value="1000KB" /> |
OlderNewer