public override void Print() { Console.WriteLine(formatter.Format("Internal Number", InternalId.ToString())); Console.WriteLine(formatter.Format("Member", Member)); Console.WriteLine(formatter.Format("Symptoms", Symptoms)); Console.WriteLine(); }
public ConcurrentUpdateException(InternalId internalId, Exception inner) : base(string.Format( "A concurrent update for internalId {0} was detected and the concurrency policy requires the transaction to fail.", internalId), inner) { }
public GraphForKeyNotFoundException(InternalId internalId, Exception inner) : base(string.Format( "Graph stored for internalId {0} is not found.", internalId), inner) { }
public override bool Equals(object?obj) { if (obj == null || obj.GetType() != GetType()) { return(false); } return(InternalId.Equals(((BaseEntry <T>)obj).InternalId)); }
public AggregateProxy(SerializationInfo info, StreamingContext context) { //Return a reference to a tracked object if available. var rawInternalId = info.GetValue(AggregateReferenceSurrogate.ReferenceInfoKey, typeof(InternalId)); if (rawInternalId == null) throw new InvalidOperationException("Expected SerializationInfo to contain an internal id for an aggregate"); internalId = (InternalId)rawInternalId; }
protected override void Given() { session = Substitute.For<ISerializationSession>(); var backingStore = Substitute.For<IBackingStore>(); var registry = new Registry(backingStore); registry.RegisterGraph<IsolatedClass>(); registry.RegisterGraph<ComposingClass>(); subject = new JsonSerializer<ComposingClass>((IRegisteredGraph<ComposingClass>)registry.RegisteredGraphs[typeof(ComposingClass)]); isolatedGraph = new IsolatedClass {AProperty = "test property"}; composingGraph = new ComposingClass {AnotherProperty = "another property", Composed = isolatedGraph}; expectedInternalId = new InternalId(Guid.NewGuid()); session.InternalIdOfTrackedGraph(isolatedGraph).Returns(expectedInternalId); }
protected override void DoExecute(System.Activities.CodeActivityContext context) { var internalId = InternalId.Get(context); devlog.DebugFormat("Entered for '{0}'", internalId); var found = Repository.EventByInternalId(internalId); try { CalDAVEvent.Set(context, found.Value); devlog.DebugFormat("found '{0}'", found.Value); } catch (NullReferenceException) { CalDAVEvent.Set(context, null); devlog.DebugFormat("found nothing"); } }
protected override void DoExecute(CodeActivityContext context) { var myInternalId = InternalId.Get(context); var myAdapter = Adapter.Get(context); devlog.Debug(string.Format("would call for '{0}' and '{1}'", myInternalId, myAdapter)); var app = AdapterAppointmentRepository.Get(myInternalId, myAdapter.Id); devlog.Debug(string.Format("found '{0}'", app)); try { appointment.Set(context, app.Value); } catch (NullReferenceException) { appointment.Set(context, null); } }
protected override void DoExecute(CodeActivityContext context) { var internalId = InternalId.Get(context); devlog.DebugFormat("Entered for '{0}'", internalId); var found = ExchangeRepository.ExchangeAppointmentByInternalId(internalId); try { ExchangeAppointment.Set(context, found.Value); devlog.DebugFormat("found '{0}'", found.Value); } catch (NullReferenceException) { ExchangeAppointment.Set(context, null); devlog.DebugFormat("found nothing"); } }
protected override void Given() { session = Substitute.For<ISerializationSession>(); var backingStore = Substitute.For<IBackingStore>(); var registry = new Registry(backingStore); registry.RegisterGraph<IsolatedClass>(); registry.RegisterGraph<ComposingClass>(); subject = new JsonSerializer<ComposingClass>((IRegisteredGraph<ComposingClass>)registry.RegisteredGraphs[typeof(ComposingClass)]); expectedInternalId = new InternalId(Guid.NewGuid()); jsonSource = @"{""Composed"":{""__StashInternalId"":""" + expectedInternalId + @"""},""AnotherProperty"":""another property""}"; serialised = new PreservedMemoryStream(); using(var sw = new StreamWriter(serialised)) sw.Write(jsonSource); expected = new IsolatedClass(); session.TrackedGraphForInternalId(expectedInternalId).Returns(expected); }
/// <summary> /// Saves the current edit model. /// </summary> /// <returns>Whether the entity was updated or not</returns> public bool Save() { using (var db = new DataContext()) { InternalId = (!String.IsNullOrEmpty(InternalId) ? InternalId.Replace(" ", "") : Name.Replace(" ", "")).ToUpper(); var site = db.SiteTrees.Where(s => s.Id == Id).SingleOrDefault(); if (site == null) { // Create new dedicated namespace var name = new Namespace() { Id = Guid.NewGuid(), Name = "Site namespace", InternalId = InternalId, Description = "Namespace for the site " + InternalId, }; db.Namespaces.Add(name); // Create site site = new SiteTree(); site.Id = Id; site.NamespaceId = NamespaceId = name.Id; db.SiteTrees.Add(site); } // If we've changed namespace, update all related permalinks. if (site.NamespaceId != NamespaceId) { ChangeNamespace(db, Id, NamespaceId); } // Update the site tree site.NamespaceId = NamespaceId; site.InternalId = InternalId; site.Name = Name; site.HostNames = HostNames; site.Description = Description; // Update the site template var template = db.PageTemplates.Include(pt => pt.RegionTemplates).Where(pt => pt.Id == Id && pt.IsSiteTemplate).SingleOrDefault(); if (template == null) { template = new PageTemplate(); db.PageTemplates.Add(template); template.Id = Id; template.Name = Id.ToString(); template.IsSiteTemplate = true; } template.Preview = Template.Preview; template.Properties = Template.Properties; // Update the regions var currentRegions = new List <Guid>(); foreach (var reg in Regions) { var region = template.RegionTemplates.Where(r => r.Id == reg.Id).SingleOrDefault(); if (region == null) { region = new RegionTemplate(); db.RegionTemplates.Add(region); template.RegionTemplates.Add(region); region.Id = Guid.NewGuid(); region.TemplateId = template.Id; region.Type = reg.Type; } region.Name = reg.Name; region.InternalId = reg.InternalId; region.Seqno = reg.Seqno; region.Description = reg.Description; currentRegions.Add(region.Id); } // Delete removed regions foreach (var reg in template.RegionTemplates.Where(r => !currentRegions.Contains(r.Id)).ToList()) { db.RegionTemplates.Remove(reg); } // Check that we have a site page, if not, create it var page = db.Pages.Where(p => p.SiteTreeId == site.Id && p.TemplateId == site.Id).SingleOrDefault(); if (page == null) { // Create page page = new Page() { Id = Guid.NewGuid(), SiteTreeId = site.Id, TemplateId = site.Id, ParentId = site.Id, Title = site.Id.ToString(), PermalinkId = Guid.NewGuid() }; // Create published version var published = page.Clone(); published.IsDraft = false; // Create permalink var permalink = new Permalink() { Id = page.PermalinkId, NamespaceId = site.NamespaceId, Name = site.Id.ToString(), Type = "SITE" }; // Attach to context page.Attach(db, EntityState.Added); published.Attach(db, EntityState.Added); permalink.Attach(db, EntityState.Added); } var ret = db.SaveChanges() > 0; Id = site.Id; // Refresh host name configuration if (ret) { WebPages.WebPiranha.RegisterDefaultHostNames(); } return(ret); } }
public Destroy(InternalId internalId, object graph, IRegisteredGraph registeredGraph) { InternalId = internalId; this.graph = graph; this.registeredGraph = registeredGraph; }
public override int GetHashCode() { return(InternalId.GetHashCode()); }
public override int GetHashCode() => 31 * InternalId.GetHashCode();