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
// Convenience property on MyDbContext for easy access to the ObjectContext | |
public ObjectContext ObjectContext | |
{ get { return ((IObjectContextAdapter)this).ObjectContext; } } | |
/* The actual problem - goes against the expected fluent API here */ | |
var ctx = new MyDbContext().ObjectContext; | |
ObjectQuery<TModel> query = ctx.CreateObjectSet<TModel>(); | |
query.Include("Site"); // Silently DOESN'T INCLUDE "Site" | |
query.OrderBy("it." + orderBy); // Silently DOESN'T ORDER BY our orderBy |
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 static class AutoMapperExtensions | |
{ | |
public static IMappingExpression<TSource, TDestination> | |
IgnoreAllNonExisting<TSource, TDestination>(this IMappingExpression<TSource, TDestination> expression) | |
{ | |
var sourceType = typeof(TSource); | |
var destinationType = typeof(TDestination); | |
var existingMaps = Mapper.GetAllTypeMaps().First(x => x.SourceType.Equals(sourceType) && x.DestinationType.Equals(destinationType)); | |
foreach (var property in existingMaps.GetUnmappedPropertyNames()) | |
{ |
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
def add_acl app_path, desiredFilesystemRights, groupOrAccountName | |
di = DirectoryInfo.new app_path | |
ds = di.GetAccessControl | |
simple_rule = FileSystemAccessRule.new( | |
groupOrAccountName, | |
desiredFilesystemRights, | |
AccessControlType.Allow | |
) |
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
module Gem | |
def self.default_exec_format | |
exec_format = ConfigMap[:ruby_install_name].sub('ruby', '%s') rescue '%s' | |
#unless exec_format =~ /%s/ then | |
# raise Gem::Exception, | |
# "[BUG] invalid exec_format #{exec_format.inspect}, no %s" | |
#end | |
exec_format |