// --------------------------------------------------------------------------------------------------------------------------------------------------------- public bool AppendPastedDetail(Idea Target, string DetailName, string MimeType, byte[] DetailContent) { if (DetailName.IsAbsent() || MimeType.IsAbsent() || DetailContent == null || DetailContent.Length < 1) { return(false); } ContainedDetail Detail = null; if (MimeType.StartsWith("text/")) { var Owner = Ownership.Create <IdeaDefinition, Idea>(Target); var Content = DetailContent.BytesToString(); if (Content.StartsWith("http://", StringComparison.InvariantCultureIgnoreCase)) { var NewLink = new ResourceLink(Target, new Assignment <DetailDesignator>( DomainServices.CreateLinkDesignation( Owner, DetailName), true)); NewLink.TargetLocation = Content; Detail = NewLink; } else if (MimeType.EndsWith("/tsv") || MimeType.EndsWith("/csv")) { var Delimiter = (MimeType.EndsWith("/csv") ? General.GetCurrentTextListDelimiter() : "\t"); var TextRecords = General.LoadStreamDelimitedIntoStrings(Content.StringToStream(), Delimiter); var TypingResult = DomainServices.GenerateTypedRecordsList(TextRecords.Item1); var TableDef = DomainServices.CreateCompatibleTableDefinition(Target.OwnerComposition.CompositeContentDomain, DetailName + " - TableDef", TypingResult.Item2, TextRecords.Item2); var Designator = new TableDetailDesignator(Owner, TableDef, true, DetailName, DetailName.TextToIdentifier()); var NewTable = new Table(Target, Designator.Assign <DetailDesignator>(true)); foreach (var DataRecord in TypingResult.Item1) { NewTable.Add(new TableRecord(NewTable, DataRecord)); } Detail = NewTable; } } if (Detail == null) { var Route = new Uri(DetailName, UriKind.RelativeOrAbsolute); Detail = this.CreateIdeaDetailAttachment(Ownership.Create <IdeaDefinition, Idea>(Target), Target, DetailName, Route, DetailContent, MimeType); if (Detail == null) { return(false); } } Target.Details.AddNew(Detail); return(true); }