This file contains 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
> [email protected] install /root/tmp/tmp-32055qma3100/build/package/node_modules/gh | |
ost/node_modules/sqlite3 | |
> node-pre-gyp install --fallback-to-build | |
node-pre-gyp http GET http://node-sqlite3.s3.amazonaws.com/Release/node_sqlite3- | |
v2.2.0-node-v11-sunos-x64.tar.gz | |
node-pre-gyp http 404 http://node-sqlite3.s3.amazonaws.com/Release/node_sqlite3- | |
v2.2.0-node-v11-sunos-x64.tar.gz | |
node-pre-gyp ERR! Source compile required: 404 status code downloading tarball | |
make: Entering directory `/root/tmp/tmp-32055qma3100/build/package/node_modules/ |
This file contains 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 NHInterceptor : EmptyInterceptor | |
{ | |
public void OnSave(object entity, | |
object id, | |
object[] state, | |
string[] propertyNames, | |
IType[] types) | |
{ | |
var genericObj = new Message<?>(entity); |
This file contains 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 void OnSave(object entity, | |
object id, | |
object[] state, | |
string[] propertyNames, | |
IType[] types) | |
{ | |
Type entityType = entity.GetType(); | |
Type genericType = typeof(Message<>); | |
Type specificType = genericType.MakeGenericType(entityType); | |
Type[] constructorParams = new[] { entityType }; |
This file contains 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
private Dictionary<Type, ConstructorInfo> _CachedLookup; | |
private object GenericMessageCreationFromCache(object entity) { | |
Type entityType = entity.GetType(); | |
ConstructorInfo genericConstructor = null; | |
if (!_CachedLookup.TryGetValue(entityType, out genericConstructor)) { | |
Type genericType = typeof(Message<>); | |
Type specificType = genericType.MakeGenericType(entityType); | |
Type[] constructorParams = new[] { entityType }; | |
genericConstructor = specificType.GetConstructor(constructorParams); |
This file contains 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 OAuthTokenUtility { | |
private readonly RSACryptoServiceProvider _PublicProvider; | |
private readonly RSACryptoServiceProvider _PrivateProvider; | |
public OAuthTokenUtility(X509Certificate2 certificate) { | |
_PublicProvider = (RSACryptoServiceProvider)certificate.PublicKey.Key; | |
_PrivateProvider = (RSACryptoServiceProvider)Certificate.PrivateKey; | |
} | |
public string Token(string username, double numberOfMinutesToExpireIn, IEnumerable<string> tokens) { |
This file contains 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
//A book example | |
public string GetSomethingFromDBAndFormat(Guid id){ | |
//Get item from DB | |
var obj = Session.Get<Something>(id); | |
var formatString = ""; | |
//check if it is null | |
if(obj!=null) { | |
//add the name to return string | |
formatString += string.Format("Name: {0}",obj.Name); |
This file contains 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
//An outline example | |
public string GetSomethingFromDBAndFormat(Guid id){ | |
var obj = Session.Get<Something>(id); | |
var formatString = GetNameFormat(obj); | |
formatString += GetNamesFromChildren(obj); | |
return formatString; | |
} | |
private string GetNameFormat(Something obj){ |
This file contains 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 RawBrokerConnectionFactory { | |
private readonly ConnectionFactory _ConnFactory = new ConnectionFactory(); | |
public RawBrokerConnectionFactory(string host, string username, string password) { | |
ConfigureConnetionFactory(host, username, password); | |
} | |
private void ConfigureConnetionFactory(string host, string username, string password) { |