public void CheckIteratorCompositionOfCompositions() { IExecute<int> identity = new SingleFunction<int>(x => x); IExecute<int> linearfunction = new SingleFunction<int>(x => x + 2); IExecute<int> quadraticfunction = new SingleFunction<int>(x => 2 * x * x); var comp1 = new Composition<int>(linearfunction, quadraticfunction); var comp2 = new Composition<int>(quadraticfunction, linearfunction); var compOfComps = new Composition<int>(comp1, comp2); var functionList = new[] { identity, linearfunction, quadraticfunction, compOfComps }; var comp = new Composition<int>(functionList); var tab0 = new[] { 0, 2, 0, 2, 0, 0, 2 }; var tab1 = new[] { 1, 3, 2, 3, 2, 2, 3 }; var tab2 = new[] { 2, 4, 8, 4, 8, 8, 4 }; var i = 0; Assert.AreEqual(7, comp.Count()); foreach (var f in comp) { Assert.AreEqual(tab0[i], f.Execute(0)); Assert.AreEqual(tab1[i], f.Execute(1)); Assert.AreEqual(tab2[i], f.Execute(2)); i++; } }
public void FasterGetPrimaryFluorescentXrayIntensityTest() { var sp = new Stopwatch(); sp.Start(); var c = new Composition(); c[79] = 0.5; c[47] = 0.5; var elements = c.Select(c1 => Elements.Get(c1.AtomicNumber)).ToArray(); var spec = fluorescent.Conditions.TubeSpectrum; var compiled = new PreprocessedDatabase(db, elements, spec.Region, spec.Division); fluorescent.Database = compiled; Action<string, LineInfo> output = (name, li) => Console.WriteLine(name + ":\t{0:e4}", fluorescent.GetPrimaryFluorescentXrayIntensity(c, li)); var lineGroups = db.LineGroups.Where(lg => c.Contains(lg.AtomicNumber)); var q = from lg in lineGroups from l in lg.Lines select new LineInfo(lg.AtomicNumber, lg, l); foreach (var li in q) output(li.Name, li); sp.Stop(); Console.WriteLine(sp.Elapsed); }
internal AutopackageModel() { CompositionData = new Composition(); DestinationDirectoryFiles = Enumerable.Empty<FileEntry>(); Roles = new XList<Role>(); Assemblies = new List<PackageAssembly>(); }
public UserComposition(User user, Composition composition) { this.Id = Guid.NewGuid(); this.User = user; this.Composition = composition; this.Save(); }
private void Add() { Composition composition = new Composition(txtID, txtTitle, Convert.ToString(txtLength), txtArtist, txtGenre, txtRating); library.Add(composition); NotifyPropertyChanged("Library"); }
public void CheckIteratorTest() { Executeable<int> identity = (Func<int, int>)((int x) => x); Executeable<int> linearfunction = (Func<int, int>)((int x) => 3 * x - 2); Executeable<int> quadraticfunction = (Func<int, int>)((int x) => 2 * x * x - 5); Executeable<int> cubicfunction = (Func<int, int>)((int x) => x * x * x + x * x + x + 1); List<Executeable<int>> functions = new List<Executeable<int>>(); functions.Add(identity); functions.Add(linearfunction); functions.Add(quadraticfunction); functions.Add(cubicfunction); Composition<int> comp = new Composition<int>(functions.ToArray()); int[] tab0 = new int[] { 0, -2, -5, 1 }; int[] tab1 = new int[] { 1, 1, -3, 4 }; int[] tab2 = new int[] { 2, 4, 3, 15 }; int i = 0; foreach (var f in comp) { Assert.AreEqual((int)f.Execute(0), tab0[i]); Assert.AreEqual((int)f.Execute(1), tab1[i]); Assert.AreEqual((int)f.Execute(2), tab2[i]); i++; } }
public PlayerMissile(string name, int exactX, int exactY, Composition owner = null) { Name = name; ExactX = exactX; ExactY = exactY; HorizontalSpeed = 0; VerticalSpeed = 0; IsVisible = true; Owner = owner; }
public void IsNormalizedTest() { var c1 = new Composition(); c1[1] = 0.9; Assert.IsFalse(c1.IsNormalized); c1[11] = 0.1; Assert.IsTrue(c1.IsNormalized); }
public void ComposeOneFunctionTest() { Executeable<int> linearfunction = (Func<int, int>)((int x) => 2 * x + 10); Composition<int> comp = new Composition<int>(linearfunction); Assert.AreEqual(10, comp.Execute(0)); Assert.AreEqual(14, comp.Execute(2)); Assert.AreEqual(20, comp.Execute(5)); }
public IonType(string name, Composition.Composition offsetComposition, int charge, bool isPrefixIon) { Name = name; OffsetComposition = offsetComposition; Charge = charge; IsPrefixIon = isPrefixIon; BaseIonType = null; _offsetMass = offsetComposition.Mass; }
public Team(string name_, Composition compo_ = null, string[] sounds_ = null, string code_ = null) { name = name_; code = code_; sounds = (sounds_ != null) ? sounds_ : new string[0]; compo = (compo_ != null) ? compo_ : new Composition("_", "_"); points = 0; nb_player = 5; players = new Dictionary<int, Player>(); }
public void NormalizeTest() { var c1 = new Composition(); c1[1] = 2; c1[2] = 3; c1.Normalize(); Assert.IsTrue(c1.IsNormalized); Assert.AreEqual(0.4, c1[1]); Assert.AreEqual(0.6, c1[2]); }
public Composition Get_Composition_By_Id(int ID) { Composition _Composition = new Composition(); DataTable dt = Composition_DA.Get_Composition_By_Id(ID); foreach (DataRow row in dt.Rows) { _Composition.ID = ID; _Composition.Compositions = row["Composition"].ToString(); } return _Composition; }
public void IndexerTest() { var c1 = new Composition(); c1[1] = 0.9; c1[11] = 0.1; var c2 = new Composition(); c2[2] = 1.0; Assert.AreEqual(2, c1.Count()); Assert.AreEqual(1, c2.Count()); Assert.AreEqual(0.1, c1[11]); }
static void Main(string[] args) { IExecute<int> identity = new SingleFunction<int>(x => x); IExecute<int> linearfunction = new SingleFunction<int>(x => 3 * x - 2); IExecute<int> quadraticfunction = new SingleFunction<int>(x => 2 * x * x - 5); IExecute<int> cubicfunction = new SingleFunction<int>(x => x * x * x + x * x + x + 1); var functionList = new[] { identity, linearfunction, quadraticfunction, cubicfunction }; var comp = new Composition<int>(functionList); Console.WriteLine(comp.Execute(5)); Console.ReadKey(); }
public static string GetImageUrl(Composition composition) { string cacheKey = composition.GetCacheKey(); if (DynamicImageCacheManager.Exists(cacheKey)) return GetUrl(cacheKey, DynamicImageCacheManager.GetProperties(cacheKey)); GeneratedImage generatedImage = composition.GenerateImage(); if (generatedImage.Properties.IsImagePresent || DynamicImageCacheManager.StoreMissingImagesInCache) { Dependency[] dependencies = composition.GetDependencies().Distinct().ToArray(); DynamicImageCacheManager.Add(cacheKey, generatedImage, dependencies); } return GetUrl(cacheKey, generatedImage.Properties); }
private readonly double _offsetMass; // duplication but stored for performance internal IonType( string name, Composition.Composition offsetComposition, int charge, BaseIonType baseIonType, NeutralLoss neutralLoss ) { Name = name; _offsetMass = offsetComposition.Mass; OffsetComposition = offsetComposition; Charge = charge; IsPrefixIon = baseIonType.IsPrefix; BaseIonType = baseIonType; NeutralLoss = neutralLoss; }
public void GetValueTest() { var collection = new ElementCoefficientCollection(); var h = Elements.Get("H"); var na = Elements.Get("Na"); collection.Add(new DummyCoef {Element = h}); collection.Add(new DummyCoef {Element = na}); var c1 = new Composition(); c1[1] = 0.9; c1[11] = 0.1; const double energy = 12345; var expected = (h.MassNumber*0.9 + na.MassNumber*0.1)*energy; var actual = collection.GetValue(c1, energy); Assert.AreEqual(expected, actual); }
public void Be_Able_To_Parse_A_Given_Line_To_A_Compostion_Model() { var expected = new Composition { MutKod = MutKod.RecordNotChanged, Code = 13099, GnEenh = 229, GnGnK = 1198, GnHoev = 200, GnStam = 41858, SrtCde = 1, StAdd = true, StEenh = 229, StHoev = 154.814m, ThsrTc = 1850, TsGneH = 2, TsStEh = 2 }; const string data = @"0731018500000010001309900119800000020000000020002290418580000001548140002000229J0000000000000000"; byte[] dataBytes = Encoding.UTF8.GetBytes(data); var memoryStream = new MemoryStream(dataBytes); var serializer = new GStandardFileSerializer<Composition>(); var lines = serializer.ReadLines(memoryStream); var model = lines.FirstOrDefault(); Assert.IsNotNull(model); Assert.AreEqual(expected.MutKod, model.MutKod); Assert.AreEqual(expected.Code, model.Code); Assert.AreEqual(expected.GnEenh, model.GnEenh); Assert.AreEqual(expected.GnGnK, model.GnGnK); Assert.AreEqual(expected.GnHoev, model.GnHoev); Assert.AreEqual(expected.GnStam, model.GnStam); Assert.AreEqual(expected.SrtCde, model.SrtCde); Assert.AreEqual(expected.StAdd, model.StAdd); Assert.AreEqual(expected.StEenh, model.StEenh); Assert.AreEqual(expected.StHoev, model.StHoev); Assert.AreEqual(expected.ThsrTc, model.ThsrTc); Assert.AreEqual(expected.TsGneH, model.TsGneH); Assert.AreEqual(expected.TsStEh, model.TsStEh); }
public override void WritePair(Composition a, Composition b) { RigidBody ba = ((BodySkin)a).Owner, bb = ((BodySkin)b).Owner; // only process collisions if: // - at least one body is active // - bodies do not share any constraints on which collisions are disabled for (int i = 0; i < bb.Constraints.Count; i++) { var c = bb.Constraints[i]; if (!c.IsCollisionEnabled && (c.BodyA == ba || c.BodyB == ba)) return; } if (ba.IsActive || bb.IsActive) { base.WritePair(a, b); } }
private async void Calculate() { var sp = new Stopwatch(); sp.Start(); var composition = new Composition( Components .Where(c => c.WeightFraction > 0) .Select(c => new Component(c.AtomicNumber, c.WeightFraction))); var target = db.LineGroups.Where(lg => composition.Contains(lg.AtomicNumber)); var q = from lg in target from l in lg.Lines let li = new LineInfo(lg.AtomicNumber, lg, l) let intensity = fluorescent.GetPrimaryFluorescentXrayIntensity(composition, li) select new LineIntensity(li, intensity); var intensities = await TaskEx.Run(() => q.ToArray()); var max = intensities.Max(i => i.Intensity); LineIntensities = intensities.OrderByDescending(li => li.Intensity) .Select(i => new LineIntensity(i.Line, i.Intensity*600d/max)); CalculationTime = sp.Elapsed; }
public void AddingFunctionToCompositionTest() { Executeable<int> identity = (Func<int, int>)((int x) => x); Composition<int> comp = new Composition<int>(identity); Assert.AreEqual(0, (int)comp.Execute(0)); Assert.AreEqual(2, (int)comp.Execute(2)); Executeable<int> linearfunction = (Func<int, int>)((int x) => x + 2); comp.Add(linearfunction); Assert.AreEqual(2, (int)comp.Execute(0)); Assert.AreEqual(4, (int)comp.Execute(2)); Executeable<int> cubicfunction = (Func<int, int>)((int x) => x * x * x); comp.Add(cubicfunction); Assert.AreEqual(8, (int)comp.Execute(0)); Assert.AreEqual(64, (int)comp.Execute(2)); }
public void AddingFunctionToComposition() { IExecute<int> identity = new SingleFunction<int>(x => x); var comp = new Composition<int>(identity); Assert.AreEqual(0, comp.Execute(0)); Assert.AreEqual(2, comp.Execute(2)); IExecute<int> linearFunction = new SingleFunction<int>(x => x + 2); comp.Add(linearFunction); Assert.AreEqual(2, comp.Execute(0)); Assert.AreEqual(4, comp.Execute(2)); IExecute<int> cubicfunction = new SingleFunction<int>(x => x * x * x); comp.Add(cubicfunction); Assert.AreEqual(8, comp.Execute(0)); Assert.AreEqual(64, comp.Execute(2)); }
public void Not_Equal_When_Code_Is_Different() { var x = new Composition { Code = 1, GnEenh = 2, GnGnK = 3, GnHoev = 4, GnStam = 5, MutKod = MutKod.RecordNotChanged, SrtCde = 6, StAdd = true, StEenh = 7, StHoev = 8, ThsrTc = 9, TsGneH = 11, TsStEh = 12 }; var y = new Composition { Code = 2, GnEenh = 2, GnGnK = 3, GnHoev = 4, GnStam = 5, MutKod = MutKod.RecordNotChanged, SrtCde = 6, StAdd = true, StEenh = 7, StHoev = 8, ThsrTc = 9, TsGneH = 11, TsStEh = 12 }; var comparer = new CompositionComparer(); Assert.IsFalse(comparer.Equals(x, y)); }
public ICollection<Composition> CompositionsInAlbum() { using (SqlCommand sqlcmd = new SqlCommand()) { List<Composition> CompositionsOfAlbum = new List<Composition>(); sqlcmd.Connection = new System.Data.SqlClient.SqlConnection(ConnectionString); sqlcmd.CommandText = @" SELECT * FROM Compositions WHERE AlbumId = @albumid"; sqlcmd.Parameters.AddWithValue("@albumid", this.Id); sqlcmd.Connection.Open(); using (var sqlreader = sqlcmd.ExecuteReader()) { if (sqlreader.HasRows) { while (sqlreader.Read()) { Composition composition = new Composition(); composition.Id = (Guid)sqlreader[0]; composition.Album = (Album)Album.FindThisInstanceInDB((Guid)sqlreader[1]); composition.Artist = (Artist)Artist.FindThisInstanceInDB((Guid)sqlreader[2]); composition.Title = (string)sqlreader[3]; composition.Subtitle = (string)sqlreader[4]; composition.Words = (string)sqlreader[5]; composition.Music = (string)sqlreader[6]; composition.Tabs = (string)sqlreader[7]; composition.Copyright = (string)sqlreader[8]; composition.Notice = (string)sqlreader[9]; //Composition.DateCreated = (DateTime)sqlreader[9]; CompositionsOfAlbum.Add(composition); } } sqlcmd.Connection.Close(); return CompositionsOfAlbum; } } }
protected IEnumerable<DeconvolutedPeak> FindMatchedPeaks(Composition.Composition fragmentComposition, double corrThreshold, double distThreshold) { var mostAbundantIsotopeIndex = fragmentComposition.GetMostAbundantIsotopeZeroBasedIndex(); var fragmentIonMass = fragmentComposition.Mass; //var matchedPeak = new MatchedFragmentPeak(); //var deconvPeak = new DeconvolutedPeak() if (fragmentIonMass < Ms2Spectrum.Peaks.First().Mz) yield break; var prevObservedCharge = 0; var fragmentIonMostAbuMass = fragmentIonMass + Constants.C13MinusC12 * mostAbundantIsotopeIndex; var chargeRange = GetMinMaxChargeRange(fragmentIonMostAbuMass); for (var charge = chargeRange.Min; charge <= chargeRange.Max; charge++) { var ion = new Ion(fragmentComposition, charge); var observedPeaks = Ms2Spectrum.GetAllIsotopePeaks(ion, Tolerance, RelativeIsotopeIntensityThreshold); if (observedPeaks == null) { if (prevObservedCharge > 0 && charge - prevObservedCharge > 1) yield break; continue; } var distCorr = GetDistCorr(ion, observedPeaks); if (distCorr.Item2 < corrThreshold && distCorr.Item1 > distThreshold) { if (prevObservedCharge > 0 && charge - prevObservedCharge > 1) yield break; continue; } var matchedPeak = new DeconvolutedPeak(fragmentIonMass, observedPeaks[mostAbundantIsotopeIndex].Intensity, charge, distCorr.Item2, distCorr.Item1, observedPeaks); prevObservedCharge = charge; yield return matchedPeak; } }
internal ScoringGraph(AminoAcid[] aminoAcidSequence, Composition sequenceComposition, ScoringGraphNode rootNode, int minPrecursorCharge, int maxPrecursorCharge) { _aminoAcidSequence = aminoAcidSequence; _sequenceComposition = sequenceComposition; _rootNode = rootNode; _minPrecursorCharge = minPrecursorCharge; _maxPrecursorCharge = maxPrecursorCharge; _precursorIon = new Dictionary<int, Ion>(); for (var precursorCharge = _minPrecursorCharge; precursorCharge <= _maxPrecursorCharge; precursorCharge++) { _precursorIon[precursorCharge] = new Ion(_sequenceComposition, precursorCharge); } // store all nodes in an array var nodes = new HashSet<ScoringGraphNode>(); var curNodes = new HashSet<ScoringGraphNode> { _rootNode }; while (curNodes.Any()) { var newNodes = new HashSet<ScoringGraphNode>(); foreach (var node in curNodes) { if (nodes.Add(node)) // if node is new { foreach (var nextNode in node.GetNextNodes()) { newNodes.Add(nextNode); } } } curNodes = newNodes; } _nodes = nodes.ToArray(); }
/// <summary> /// When called from a broad phase detection implementation, provides a pair of potentially colliding compositions for further /// consideration by a narrow phase implementation. /// </summary> /// <param name="a">The first composition in the potential collision.</param> /// <param name="b">The second composition in the potential collision.</param> public virtual void WritePair(Composition a, Composition b) { for (int i = 0; i < a.Count; i++) { for (int j = 0; j < b.Count; j++) { ulong key1 = ((ulong)a[i].GetType().GetHashCode() << sizeof(int) * 8) + (ulong)b[j].GetType().GetHashCode(); ulong key2 = ((ulong)b[j].GetType().GetHashCode() << sizeof(int) * 8) + (ulong)a[i].GetType().GetHashCode(); if (_tests.ContainsKey(key1)) { this.Test(_tests[key1], a[i], b[j]); } else if (_tests.ContainsKey(key2)) { this.Test(_tests[key2], b[j], a[i]); } else { System.Diagnostics.Debug.WriteLine("No collision test registered for types " + a.GetType().FullName + " and " + b.GetType().FullName); } } } }
public void CheckIterator() { IExecute<int> identity = new SingleFunction<int>(x => x); IExecute<int> linearfunction = new SingleFunction<int>(x => 3 * x - 2); IExecute<int> quadraticfunction = new SingleFunction<int>(x => 2 * x * x - 5); IExecute<int> cubicfunction = new SingleFunction<int>(x => x * x * x + x * x + x + 1); var functionList = new[] { identity, linearfunction, quadraticfunction, cubicfunction }; var comp = new Composition<int>(functionList); var tab0 = new[] { 0, -2, -5, 1 }; var tab1 = new[] { 1, 1, -3, 4 }; var tab2 = new[] { 2, 4, 3, 15 }; var i = 0; foreach (var f in comp) { Assert.AreEqual(tab0[i], f.Execute(0)); Assert.AreEqual(tab1[i], f.Execute(1)); Assert.AreEqual(tab2[i], f.Execute(2)); i++; } }
public void Compose(Composition composition) { composition.Sections().Append <CustomUserListSection>(); composition.Sections().Insert <CustomUserListSection>(4); }
public void Compose(Composition composition) { composition.Components().Append <MigrationComponent>(); }
/// <summary> /// Gets the cache refreshers collection builder. /// </summary> /// <param name="composition">The composition.</param> public static CacheRefresherCollectionBuilder CacheRefreshers(this Composition composition) => composition.WithCollectionBuilder <CacheRefresherCollectionBuilder>();
/// <summary> /// Sets the server messenger. /// </summary> /// <typeparam name="T">The type of the server registrar.</typeparam> /// <param name="composition">The composition.</param> public static void SetServerMessenger <T>(this Composition composition) where T : IServerMessenger { composition.RegisterUnique <IServerMessenger, T>(); }
private IEnumerable <int> SwizzleIndices(IList <int> indices, Size imageSize, IImageSwizzle swizzle) { return(Composition.GetPointSequence(imageSize, swizzle) .Select(point => indices[GetIndex(point, imageSize)])); }
/// <summary>Compose.</summary> public void Compose(Composition composition) { composition.Sections().Append <CustomCodeSection>(); }
/// <summary> /// Gets the property value converters collection builder. /// </summary> /// <param name="composition">The composition.</param> public static PropertyValueConverterCollectionBuilder PropertyValueConverters(this Composition composition) => composition.WithCollectionBuilder <PropertyValueConverterCollectionBuilder>();
/// <summary> /// Gets the data editor collection builder. /// </summary> /// <param name="composition">The composition.</param> public static DataEditorCollectionBuilder DataEditors(this Composition composition) => composition.WithCollectionBuilder <DataEditorCollectionBuilder>();
/// <summary> /// Gets the package actions collection builder. /// </summary> /// <param name="composition">The composition.</param> internal static PackageActionCollectionBuilder PackageActions(this Composition composition) => composition.WithCollectionBuilder <PackageActionCollectionBuilder>();
/// <summary> /// Sets the underlying media filesystem. /// </summary> /// <param name="composition">A composition.</param> /// <param name="filesystemFactory">A filesystem factory.</param> public static void SetMediaFileSystem(this Composition composition, Func <IFileSystem> filesystemFactory) => composition.RegisterUniqueFor <IFileSystem, IMediaFileSystem>(_ => filesystemFactory());
/// <summary> /// De-registers a Property Value Converter while ensuring it remains in the DI container /// </summary> public static Composition DisableConverter <T>(this Composition composition) where T : class, IPropertyValueConverter { return(composition.DisableConverter(typeof(T))); }
/// <summary> /// Sets the log viewer. /// </summary> /// <param name="composition">The composition.</param> /// <param name="factory">A function creating a log viewer.</param> public static void SetLogViewer(this Composition composition, Func <IFactory, ILogViewer> factory) { composition.RegisterUnique(factory); }
/// <summary> /// Sets the short string helper. /// </summary> /// <typeparam name="T">The type of the short string helper.</typeparam> /// <param name="composition">The composition.</param> public static void SetShortStringHelper <T>(this Composition composition) where T : IShortStringHelper { composition.RegisterUnique <IShortStringHelper, T>(); }
/// <summary> /// Sets the server messenger. /// </summary> /// <param name="composition">The composition.</param> /// <param name="registrar">A server messenger.</param> public static void SetServerMessenger(this Composition composition, IServerMessenger registrar) { composition.RegisterUnique(_ => registrar); }
/// <summary> /// Sets the short string helper. /// </summary> /// <param name="composition">A composition.</param> /// <param name="helper">A short string helper.</param> public static void SetShortStringHelper(this Composition composition, IShortStringHelper helper) { composition.RegisterUnique(_ => helper); }
/// <summary> /// Sets the server messenger. /// </summary> /// <param name="composition">The composition.</param> /// <param name="factory">A function creating a server messenger.</param> public static void SetServerMessenger(this Composition composition, Func <IFactory, IServerMessenger> factory) { composition.RegisterUnique(factory); }
/// <summary> /// Sets the short string helper. /// </summary> /// <param name="composition">The composition.</param> /// <param name="factory">A function creating a short string helper.</param> public static void SetShortStringHelper(this Composition composition, Func <IFactory, IShortStringHelper> factory) { composition.RegisterUnique(factory); }
/// <summary> /// Sets the published content model factory. /// </summary> /// <param name="composition">The composition.</param> /// <param name="factory">A published content model factory.</param> public static void SetPublishedContentModelFactory(this Composition composition, IPublishedModelFactory factory) { composition.RegisterUnique(_ => factory); }
/// <summary> /// Sets the culture dictionary factory. /// </summary> /// <param name="composition">The composition.</param> /// <param name="factory">A function creating a culture dictionary factory.</param> public static void SetCultureDictionaryFactory(this Composition composition, Func <IFactory, ICultureDictionaryFactory> factory) { composition.RegisterUnique(factory); }
public static Composition ComposeServices(this Composition composition) { // register a transient messages factory, which will be replaced by the web // boot manager when running in a web context composition.RegisterUnique <IEventMessagesFactory, TransientEventMessagesFactory>(); // register the service context composition.RegisterUnique <ServiceContext>(); // register the special idk map composition.RegisterUnique <IdkMap>(); // register the services composition.RegisterUnique <IKeyValueService, KeyValueService>(); composition.RegisterUnique <IPublicAccessService, PublicAccessService>(); composition.RegisterUnique <IDomainService, DomainService>(); composition.RegisterUnique <IAuditService, AuditService>(); composition.RegisterUnique <ITagService, TagService>(); composition.RegisterUnique <IContentService, ContentService>(); composition.RegisterUnique <IUserService, UserService>(); composition.RegisterUnique <IMemberService, MemberService>(); composition.RegisterUnique <IMediaService, MediaService>(); composition.RegisterUnique <IContentTypeService, ContentTypeService>(); composition.RegisterUnique <IContentTypeBaseServiceProvider, ContentTypeBaseServiceProvider>(); composition.RegisterUnique <IMediaTypeService, MediaTypeService>(); composition.RegisterUnique <IDataTypeService, DataTypeService>(); composition.RegisterUnique <IFileService, FileService>(); composition.RegisterUnique <ILocalizationService, LocalizationService>(); composition.RegisterUnique <IPackagingService, PackagingService>(); composition.RegisterUnique <IServerRegistrationService, ServerRegistrationService>(); composition.RegisterUnique <IEntityService, EntityService>(); composition.RegisterUnique <IRelationService, RelationService>(); composition.RegisterUnique <IMacroService, MacroService>(); composition.RegisterUnique <IMemberTypeService, MemberTypeService>(); composition.RegisterUnique <IMemberGroupService, MemberGroupService>(); composition.RegisterUnique <INotificationService, NotificationService>(); composition.RegisterUnique <IExternalLoginService, ExternalLoginService>(); composition.RegisterUnique <IRedirectUrlService, RedirectUrlService>(); composition.RegisterUnique <IConsentService, ConsentService>(); composition.Register <LocalizedTextServiceFileSources>(SourcesFactory); composition.RegisterUnique <ILocalizedTextService>(factory => new LocalizedTextService( factory.GetInstance <Lazy <LocalizedTextServiceFileSources> >(), factory.GetInstance <ILogger>())); composition.RegisterUnique <IEntityXmlSerializer, EntityXmlSerializer>(); composition.RegisterUnique <IPackageActionRunner, PackageActionRunner>(); composition.RegisterUnique <ConflictingPackageData>(); composition.RegisterUnique <CompiledPackageXmlParser>(); composition.RegisterUnique <ICreatedPackagesRepository>(factory => CreatePackageRepository(factory, "createdPackages.config")); composition.RegisterUnique <IInstalledPackagesRepository>(factory => CreatePackageRepository(factory, "installedPackages.config")); composition.RegisterUnique <PackageDataInstallation>(); composition.RegisterUnique <PackageFileInstallation>(); composition.RegisterUnique <IPackageInstallation>(factory => //factory required because we need to pass in a string path new PackageInstallation( factory.GetInstance <PackageDataInstallation>(), factory.GetInstance <PackageFileInstallation>(), factory.GetInstance <CompiledPackageXmlParser>(), factory.GetInstance <IPackageActionRunner>(), new DirectoryInfo(IOHelper.GetRootDirectorySafe()))); return(composition); }
public void Compose(Composition composition) { // Append our component to the collection of Components // It will be the last one to be run composition.Components().Append <MyComponent>(); }
/// <summary> /// Gets the url segment providers collection builder. /// </summary> /// <param name="composition">The composition.</param> public static UrlSegmentProviderCollectionBuilder UrlSegmentProviders(this Composition composition) => composition.WithCollectionBuilder <UrlSegmentProviderCollectionBuilder>();
/// <summary> /// Sets the log viewer. /// </summary> /// <typeparam name="T">The type of the log viewer.</typeparam> /// <param name="composition">The composition.</param> public static void SetLogViewer <T>(this Composition composition) where T : ILogViewer { composition.RegisterUnique <ILogViewer, T>(); }
public void Compose(Composition composition) { composition.Components().Append <PreventUpdatingPlaylistUrl>(); composition.Components().InsertAfter <PreventUpdatingPlaylistUrl, ExtractDetailsFromPlaylistUrl>(); composition.Components().Append <ImportPlaylistVideosAfterSave>(); }
/// <summary> /// Gets the validators collection builder. /// </summary> /// <param name="composition">The composition.</param> internal static ManifestValueValidatorCollectionBuilder Validators(this Composition composition) => composition.WithCollectionBuilder <ManifestValueValidatorCollectionBuilder>();
/// <summary> /// Gets the components collection builder. /// </summary> public static ComponentCollectionBuilder Components(this Composition composition) => composition.WithCollectionBuilder <ComponentCollectionBuilder>();
/// <summary> /// Sets the culture dictionary factory. /// </summary> /// <typeparam name="T">The type of the factory.</typeparam> /// <param name="composition">The composition.</param> public static void SetCultureDictionaryFactory <T>(this Composition composition) where T : ICultureDictionaryFactory { composition.RegisterUnique <ICultureDictionaryFactory, T>(); }
/// <summary> /// Sets the log viewer. /// </summary> /// <param name="composition">A composition.</param> /// <param name="helper">A log viewer.</param> public static void SetLogViewer(this Composition composition, ILogViewer viewer) { composition.RegisterUnique(_ => viewer); }
/// <summary> /// Sets the published content model factory. /// </summary> /// <typeparam name="T">The type of the factory.</typeparam> /// <param name="composition">The composition.</param> public static void SetPublishedContentModelFactory <T>(this Composition composition) where T : IPublishedModelFactory { composition.RegisterUnique <IPublishedModelFactory, T>(); }
public virtual Node VisitComposition(Composition comp, Composition changes, Composition deletions, Composition insertions){ this.UpdateSourceContext(comp, changes); if (comp == null) return changes; if (changes != null){ if (deletions == null || insertions == null) Debug.Assert(false); else{ comp.Expression = this.VisitExpression(comp.Expression, changes.Expression, deletions.Expression, insertions.Expression); } }else if (deletions != null) return null; return comp; }
/// <summary> /// Gets the mappers collection builder. /// </summary> /// <param name="composition">The composition.</param> public static MapperCollectionBuilder Mappers(this Composition composition) => composition.WithCollectionBuilder <MapperCollectionBuilder>();