public PEDeltaAssemblyBuilder( SourceAssemblySymbol sourceAssembly, string outputName, OutputKind outputKind, ModulePropertiesForSerialization serializationProperties, IEnumerable<ResourceDescription> manifestResources, Func<AssemblySymbol, AssemblyIdentity> assemblySymbolMapper, EmitBaseline previousGeneration, IEnumerable<SemanticEdit> edits) : base(sourceAssembly, outputName, outputKind, serializationProperties, manifestResources, assemblySymbolMapper, additionalTypes: ImmutableArray<NamedTypeSymbol>.Empty) { var context = new Context(this, null, new DiagnosticBag()); var module = previousGeneration.OriginalMetadata; var compilation = sourceAssembly.DeclaringCompilation; var metadataAssembly = compilation.GetBoundReferenceManager().CreatePEAssemblyForAssemblyMetadata(AssemblyMetadata.Create(module), MetadataImportOptions.All); var metadataDecoder = new Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE.MetadataDecoder(metadataAssembly.PrimaryModule); previousGeneration = EnsureInitialized(previousGeneration, metadataDecoder); var matchToMetadata = new SymbolMatcher(previousGeneration.AnonymousTypeMap, sourceAssembly, context, metadataAssembly); SymbolMatcher matchToPrevious = null; if (previousGeneration.Ordinal > 0) { var previousAssembly = ((CSharpCompilation)previousGeneration.Compilation).SourceAssembly; var previousContext = new Context((PEModuleBuilder)previousGeneration.PEModuleBuilder, null, new DiagnosticBag()); matchToPrevious = new SymbolMatcher(previousGeneration.AnonymousTypeMap, sourceAssembly, context, previousAssembly, previousContext); } this.previousDefinitions = new DefinitionMap(previousGeneration.OriginalMetadata.Module, metadataDecoder, matchToMetadata, matchToPrevious, GenerateMethodMap(edits)); this.previousGeneration = previousGeneration; this.changes = new SymbolChanges(this.previousDefinitions, edits); }
public void TestFixtureSetUp() { factory = new InterceptingProxyFactory(); var map = new DefinitionMap(); factory.Initialize(new[] { typeof(InterceptableItem), typeof(InterceptableInheritorItem), typeof(IgnoringItem) }.Select(t => map.GetOrCreateDefinition(t))); }
/// <summary>Stores dependencies</summary> /// <param name="finder"></param> /// <param name="repository"></param> /// <param name="activator"></param> public ContainerRepository(IRepository <ContentItem> repository, IHost host, ContentActivator activator, DefinitionMap map) { this.repository = repository; this.host = host; this.activator = activator; this.map = map; }
public FluentDefinitionProvider(DefinitionMap map, IFluentRegisterer[] registerers) { var definitions = registerers .OrderBy(r => Utility.InheritanceDepth(r.RegisteredType)) .SelectMany(r => r.Register(map)); definitionsCache = definitions.ToArray(); }
public virtual IEnumerable <ItemDefinition> Register(DefinitionMap map) { var registration = new ContentRegistration <T>(map.GetOrCreateDefinition(RegisteredType)); registration.IsDefined = true; RegisterDefinition(registration); return(new [] { registration.Finalize() }); }
public DefinitionManager(IDefinitionProvider[] definitionProviders, ContentActivator activator, StateChanger changer, DefinitionMap map) { this.definitionProviders = definitionProviders.OrderBy(dp => dp.SortOrder).ToArray(); this.activator = activator; this.stateChanger = changer; this.map = map; activator.Initialize(GetDefinitions()); }
public static IDefinitionProvider[] SetupDefinitionProviders(DefinitionMap map, params Type[] itemTypes) { IDefinitionProvider[] definitionProviders; ITypeFinder typeFinder = new Fakes.FakeTypeFinder(itemTypes.Select(t => t.Assembly).FirstOrDefault() ?? Assembly.GetExecutingAssembly(), itemTypes); var definitionBuilder = new DefinitionBuilder(map, typeFinder, new TransformerBase <IUniquelyNamed> [0], SetupEngineSection()); definitionProviders = new IDefinitionProvider[] { new DefinitionProvider(definitionBuilder) }; return(definitionProviders); }
public static void Setup(out IDefinitionProvider[] definitionProviders, out IDefinitionManager definitions, out ContentActivator activator, out IItemNotifier notifier, out InterceptingProxyFactory proxyFactory, params Type[] itemTypes) { var map = new DefinitionMap(); definitionProviders = SetupDefinitionProviders(map, itemTypes); notifier = new ItemNotifier(); proxyFactory = new InterceptingProxyFactory(); activator = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, proxyFactory); definitions = new DefinitionManager(definitionProviders, activator, new StateChanger(), new DefinitionMap()); ((DefinitionManager)definitions).Start(); }
public InstallationManager(IHost host, DefinitionMap map, ContentActivator activator, Importer importer, IPersister persister, ISessionProvider sessionProvider, IConfigurationBuilder configurationBuilder, IWebContext webContext) { this.host = host; this.map = map; this.activator = activator; this.importer = importer; this.persister = persister; this.sessionProvider = sessionProvider; this.configurationBuilder = configurationBuilder; this.webContext = webContext; }
public static void Setup(out IDefinitionManager definitions, out ITemplateAggregator templates, out ContentActivator activator, params Type[] itemTypes) { var map = new DefinitionMap(); var definitionProviders = SetupDefinitionProviders(map, itemTypes); var notifier = new ItemNotifier(); var proxyFactory = new InterceptingProxyFactory(); activator = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, proxyFactory); definitions = new DefinitionManager(definitionProviders, activator, new StateChanger(), new DefinitionMap()); templates = new TemplateAggregator(definitions, new[] { new TemplateProvider(activator, map) }); ((IAutoStart)definitions).Start(); ((IAutoStart)templates).Start(); }
public InstallationManager(IHost host, DefinitionMap map, ContentActivator activator, Importer importer, IPersister persister, ISessionProvider sessionProvider, IConfigurationBuilder configurationBuilder, IWebContext webContext, ConnectionMonitor connectionContext, DatabaseSection config) { this.host = host; this.map = map; this.activator = activator; this.importer = importer; this.persister = persister; this.sessionProvider = sessionProvider; this.configurationBuilder = configurationBuilder; this.webContext = webContext; this.connectionContext = connectionContext; this.isDatabaseFileSystemEnbled = config.Files.StorageLocation == FileStoreLocation.Database; }
public static void Setup(out IDefinitionProvider[] definitionProviders, out IDefinitionManager definitions, out ContentActivator activator, out IItemNotifier notifier, out InterceptingProxyFactory proxyFactory, params Type[] itemTypes) { ITypeFinder typeFinder = new Fakes.FakeTypeFinder(itemTypes.Select(t => t.Assembly).FirstOrDefault() ?? Assembly.GetExecutingAssembly(), itemTypes); var map = new DefinitionMap(); var definitionBuilder = new DefinitionBuilder(map, typeFinder, new TransformerBase <IUniquelyNamed> [0], SetupEngineSection()); notifier = new ItemNotifier(); proxyFactory = new InterceptingProxyFactory(); activator = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, proxyFactory); definitionProviders = new IDefinitionProvider[] { new DefinitionProvider(definitionBuilder) }; definitions = new DefinitionManager(definitionProviders, new [] { new TemplateProvider(activator, map) }, activator, new StateChanger()); ((DefinitionManager)definitions).Start(); }
public override void SetUp() { base.SetUp(); user = CreatePrincipal("SomeSchmuck"); map = new DefinitionMap(); DefinitionBuilder builder = new DefinitionBuilder(map, typeFinder, new TransformerBase <IUniquelyNamed> [0], new EngineSection()); IItemNotifier notifier = mocks.DynamicMock <IItemNotifier>(); mocks.Replay(notifier); var changer = new N2.Edit.Workflow.StateChanger(); activator = new ContentActivator(changer, notifier, new EmptyProxyFactory()); definitions = new DefinitionManager(new[] { new DefinitionProvider(builder) }, activator, changer, new DefinitionMap()); }
public static void Setup(out IDefinitionManager definitions, out ContentActivator activator, out IItemNotifier notifier, out FakeSessionProvider sessionProvider, out ItemFinder finder, out SchemaExport schemaCreator, out InterceptingProxyFactory proxyFactory, IWebContext context, DatabaseSection config, ConfigurationBuilderParticipator[] participators, params Type[] itemTypes) { IDefinitionProvider[] definitionProviders; Setup(out definitionProviders, out definitions, out activator, out notifier, out proxyFactory, itemTypes); var connectionStrings = (ConnectionStringsSection)ConfigurationManager.GetSection("connectionStrings"); var map = new DefinitionMap(); var configurationBuilder = new ConfigurationBuilder(definitionProviders, new ClassMappingGenerator(map), new ThreadContext(), participators, config, connectionStrings); var configurationSource = new ConfigurationSource(configurationBuilder); sessionProvider = new FakeSessionProvider(configurationSource, new NHInterceptorFactory(proxyFactory, notifier), context); sessionProvider.CurrentSession = null; finder = new ItemFinder(sessionProvider, map); schemaCreator = new SchemaExport(configurationSource.BuildConfiguration()); }
public void ExportedImportedItem_AutoGeneratedProperties_AreImported() { var item = definitions.CreateInstance <XmlableItem2>(null); item.AutoPropertyString = "Hello World!"; // simulate saving proxied items - this is most likely the case in normal operation var pf = new N2.Persistence.Proxying.InterceptingProxyFactory(); var map = new DefinitionMap(); pf.Initialize(new [] { map.GetOrCreateDefinition(typeof(XmlableItem2)) }); pf.OnSaving(item); var readItem = ExportAndImport(item, ExportOptions.Default); Assert.That(readItem.AutoPropertyString, Is.EqualTo(item.AutoPropertyString)); }
public void NewChild_IsSaved() { var item = new DecoratedItem(); var definition = new DefinitionMap().GetOrCreateDefinition(item); var editable = (EditableItemAttribute)definition.Properties["TheItem"].Editable; var page = new Page(); var enclosingEditor = new ItemEditor(); var editor = AddEditorAndInit(item, editable, page, enclosingEditor); editable.UpdateEditor(item, editor); var ctx = new N2.Edit.Workflow.CommandContext(definition, item, Interfaces.Editing, engine.RequestContext.User); enclosingEditor.UpdateObject(ctx); ctx.GetItemsToSave().ShouldContain(item.TheItem); }
public void ItemEditor_AddsNewChild() { var item = new DecoratedItem(); var definition = new DefinitionMap().GetOrCreateDefinition(item); var editable = (EditableItemAttribute)definition.Properties["TheItem"].Editable; var page = new Page(); var enclosingEditor = new ItemEditor(); var editor = AddEditorAndInit(item, editable, page, enclosingEditor); editable.UpdateEditor(item, editor); ItemUtility.FindInChildren <N2.Web.UI.WebControls.NameEditor>(editor).Single().Text = "Hello child"; enclosingEditor.UpdateObject(new N2.Edit.Workflow.CommandContext(definition, item, Interfaces.Editing, engine.RequestContext.User)); item.Children.Single().ShouldBe(item.TheItem); }
public ContentTemplateRepository(IPersister persister, DefinitionMap map, ContainerRepository <TemplateContainer> container) { this.persister = persister; this.map = map; this.container = container; }
public CrossLinkDefinitionBuilder(DefinitionMap staticDefinitions, CrossLinkTypeFinder typeFinder, TransformerBase <IUniquelyNamed>[] transformers, EngineSection config) : base(staticDefinitions, typeFinder, transformers, config) { }
public void SetUp() { Context.Replace(engine = new Fakes.FakeEngine(new[] { typeof(DecoratedItem), typeof(DecoratedItem2) })); engine.AddComponentInstance <ITemplateAggregator>(new TemplateAggregator(engine.Definitions, new ITemplateProvider[] { new TemplateProvider(TestSupport.SetupContentActivator(), map = new DefinitionMap()) })); }
public FakePartsAdapter(DefinitionMap map) { this.map = map; }
public ViewTemplateAnalyzer(IProvider <ViewEngineCollection> viewEnginesProvider, DefinitionMap map, DefinitionBuilder builder) { this.viewEnginesProvider = viewEnginesProvider; this.map = map; this.builder = builder; }
public ClassMappingGenerator(DefinitionMap map) { this.map = map; }
public BehaviorInvoker(IPersister persister, DefinitionMap definitionMap, params IBehavior[] generalBehaviors) { this.persister = persister; this.definitionMap = definitionMap; this.generalBehaviors = generalBehaviors; }
public ChildGroupSource(DefinitionMap map) { this.map = map; }
public ItemFinder(ISessionProvider sessionProvider, DefinitionMap map) { this.sessionProvider = sessionProvider; this.map = map; }
public QueryBuilder(ISessionProvider sessionProvider, DefinitionMap map) { this.sessionProvider = sessionProvider; this.map = map; }
public ContentTemplateRepository(IRepository <ContentItem> repository, DefinitionMap map, ContainerRepository <TemplateContainer> container) { this.repository = repository; this.map = map; this.container = container; }
public RavenInstallationManager(IHost host, DefinitionMap map, ContentActivator activator, Importer importer, IPersister persister, ISessionProvider sessionProvider, IConfigurationBuilder configurationBuilder, IWebContext webContext, ConnectionMonitor connectionContext, DatabaseSection config, RavenConnectionProvider cp) : base(connectionContext, importer, webContext, persister, activator) { this.cp = cp; }