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 void Configure(UnityContainer container) | |
{ | |
//Mix explicit mapping with Auto-Registration | |
container.RegisterType<IEntityFrameworkUnitOfWork, UnitOfWork>(new HierarchicalLifetimeManager(), new InjectionConstructor()); | |
//Select only repositories in loaded assemblies | |
container.RegisterTypes(AllClasses.FromLoadedAssemblies() | |
.Where(type => type.BaseType != null && type.BaseType.IsGenericType && | |
type.BaseType.GetGenericTypeDefinition() == typeof(BaseRepository<>)), | |
WithMappings.FromMatchingInterface, |
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 ConfigurationStore : DynamicObject | |
{ | |
public static TModel GetStore<TModel>() | |
{ | |
return (dynamic)new ConfigurationStore(); | |
} | |
private object GetConfigurationValue(string name) | |
{ | |
object value = null; |
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 Rules | |
{ | |
private string passcode; | |
public Rules(string passcode) | |
{ | |
this.passcode = passcode; | |
} | |
internal string Match(string code) |
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 System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Ormazabal.PanelMonitoring.Helpers | |
{ | |
static class Expressions |
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
Add-Account | |
Select-Subscription -SubscriptionName mysubscription |
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 WebApiUnityFilterProvider : ActionDescriptorFilterProvider, IFilterProvider | |
{ | |
private readonly IUnityContainer container; | |
public WebApiUnityFilterProvider(IUnityContainer container) | |
{ | |
this.container = container; | |
} | |
public new IEnumerable<FilterInfo> GetFilters(HttpConfiguration configuration, HttpActionDescriptor actionDescriptor) |
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 void RegisterTypes(IUnityContainer container) | |
{ | |
// NOTE: To load from web.config uncomment the line below. Make sure to add a Microsoft.Practices.Unity.Configuration to the using statements. | |
// container.LoadConfiguration(); | |
container.RegisterType<IUnitOfWork, UnitOfWork>(new PerRequestLifetimeManager()); | |
} |
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
internalstaticclass TypeActivator | |
{ | |
public static Func<TBase> Create<TBase>(Type instanceType) | |
where TBase : class | |
{ | |
Contract.Assert(instanceType != null); | |
NewExpression newInstanceExpression = Expression.New(instanceType); | |
return Expression.Lambda<Func<TBase>>(newInstanceExpression).Compile(); | |
} |
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
$fieldName = "field" | |
$contentTypeId = New-Object Microsoft.Sharepoint.SPContentTypeId("0x010100629D00608F814DD6AC8A86903AEE72AA") | |
Add-PSSnapin Microsoft.Sharepoint.Powershell | |
$web = Get-SPWeb http://cun04 | |
$contentType = $web.ContentTypes | ? { $_.ID.IsParentOf($contentTypeId) } | |
$contentType.FieldLinks.Delete($fieldName) | |
$contentType.Update($true) |