예제 #1
0
        /// <summary>
        /// Create an Erdas image file given specs
        /// </summary>
        public Image(string filename,
                     Dimensions dimensions,
                     int bandCount,
                     System.TypeCode bandType,
                     IMetadata metadata)
        {
            // if filename does not end in .gis or .lan throw exception
            string extension = Path.GetExtension(filename).ToLower();
            if (!(extension.Equals(".gis")) && !(extension.Equals(".lan")))
                throw new ApplicationException("Erdas image must have either GIS or LAN as extension");
                
            // if dimensions are messed up throw exception
            if ((dimensions.Rows < 1) || (dimensions.Columns < 1))
                throw new ApplicationException("Erdas image given invalid dimensions");
                
            // if bandCount messed up throw exception
            if ((bandCount < 1) || (bandCount > 0xffff))
                throw new ApplicationException("Erdas image given invalid band count");
            
            // more bandCount checking
            if (extension.Equals(".gis"))
            {
                if (bandCount > 1)
                    throw new ApplicationException("Erdas GIS files cannot support multiband images");
            }
                
            this.imageHeader =
                new ImageHeader(dimensions, bandType, bandCount, metadata);

            this.imageHeader.Write(filename);            
        }
예제 #2
0
 /// <summary>
 /// Builds a new RelationshipObject with links and linkage
 /// </summary>
 public RelationshipObject(IResourceLinkage linkage, ILink selfLink, ILink relatedResourceLink, IMetadata metadata = null)
 {
     Linkage = linkage;
     SelfLink = selfLink;
     RelatedResourceLink = relatedResourceLink;
     Metadata = metadata;
 }
 public void Remove(IMetadata item)
 {
     if (AugmentedCollection.Contains(item))
     {
         item.Delete();
         AugmentedCollection.Remove(item);
     }
 }
예제 #4
0
 internal string Serialize(IMetadata metadata)
 {
     Type[] types = metadata.GetType().GetGenericArguments();
     var xmlSerializer = new XmlSerializer(metadata.GetType(), types);
     var memoryStream = new MemoryStream();
     xmlSerializer.Serialize(memoryStream, metadata);
     return Encoding.UTF8.GetString(memoryStream.ToArray());
 }
        /// <summary>
        /// Adds a Metadata (XML) datastream, takes IMetadata object as the metadata
        /// </summary>
        /// <param name="dsId">DatastreamID</param>
        /// <param name="dsLabel">Datastream Label</param>
        /// <param name="inMetadata">Metadata object</param>
        /// <param name="mimeType">The mime type (usually "text/xml") but could be different e.g application/rdf+xml</param>
        public void AddMetadataDatastream(string dsId, string dsLabel, IMetadata inMetadata, string mimeType )
        {
            IMetadata metadata = inMetadata;

            //Creates a new ObjectDatastream
            IObjectDatastream objectDatastream = new ObjectDatastreamImpl(dsId, dsLabel, mimeType, metadata.FormatURI, null, "DISABLED", "A", "X", true, 0, null, metadata.Xml, null);
            genericObject.AddDatastream(objectDatastream); //Adds to the genericObject
        }
		//---------------------------------------------------------------------

		public OutputRaster(string     path,
		                    Dimensions dimensions,
		                    IMetadata  metadata)
			: base(path, dimensions, metadata)
		{
			this.pixelsWritten = 0;
			this.disposed = false;
		}
        public ISingleResourceDocument BuildDocument(object primaryData, string linkBaseUrl, string[] includePathExpressions, IMetadata topLevelMetadata)
        {
            var idDictionariesByType = new Dictionary<string, IDictionary<string, ResourceObject>>();
            var primaryDataResource = CreateResourceObject(primaryData, idDictionariesByType, null, includePathExpressions, linkBaseUrl);

            var relatedData = idDictionariesByType.Values.SelectMany(d => d.Values).Cast<IResourceObject>().ToArray();
            var document = new SingleResourceDocument(primaryDataResource, relatedData, topLevelMetadata);
            return document;
        }
 public override object Get(string key, IMetadata metadata)
 {
     if (!_cached)
     {
         _cachedValue = base.Get(key, metadata);
         _cached = true;
     }
     return _cachedValue;
 }
예제 #9
0
		//---------------------------------------------------------------------

		public Raster(string     path,
		              Dimensions dimensions,
		              IMetadata  metadata)
		{
			this.path = path;
			this.dimensions = dimensions;
			this.metadata = metadata;
			this.disposed = false;
		}
예제 #10
0
 /// <summary>
 /// Creates a ResourceObject
 /// </summary>
 public ResourceObject(string type, string id, IDictionary<string, JToken> attributes = null,
     IDictionary<string, IRelationshipObject> relationships = null, ILink selfLink = null, IMetadata metadata = null)
 {
     Type = type;
     Id = id;
     Attributes = attributes ?? new Dictionary<string, JToken>();
     Relationships = relationships ?? new Dictionary<string, IRelationshipObject>();
     SelfLink = selfLink;
     Metadata = metadata;
 }
예제 #11
0
		//---------------------------------------------------------------------

		/// <summary>
		/// Initializes a new instance.
		/// </summary>
		/// <param name="path">
		/// Path to the raster file that represents the map.
		/// </param>
		/// <param name="ecoregions">Dataset of ecoregions</param>
		public Map(string   path,
		           IDataset ecoregions)
		{
			this.path = path;
			this.ecoregions = ecoregions;
			IInputRaster<Pixel> map = Util.Raster.Open<Pixel>(path);
			using (map) {
				this.metadata = map.Metadata;
			}
		}
예제 #12
0
 public MediaData(string url, string contentType, IMetadata metadata = null, string streamType = "BUFFERED", double duration = 0d, object customData = null, Track[] tracks = null)
 {
     Url = url;
     ContentType = contentType;
     StreamType = streamType;
     Duration = duration;
     Metadata = metadata;
     CustomData = customData;
     Tracks = tracks;
 }
예제 #13
0
		public MetadataObjectBaseCore(IMetadata builtFrom,
				IIdentifiableRetrievalManager retrievalManager) : base(builtFrom) {
			this.metadataSet = new List<IMetadataSetBase>();
			this.builtFrom = builtFrom;
			/* foreach */
			foreach (IMetadataSet currentMS  in  builtFrom.MetadataSet) {
				metadataSet.Add(new MetadataSetBaseCore(currentMS,
									retrievalManager));
			}
		}
예제 #14
0
 public SerializedEvent(
     string meta,
     string data,
     int aggregateSequenceNumber,
     IMetadata metadata)
 {
     Meta = meta;
     Data = data;
     AggregateSequenceNumber = aggregateSequenceNumber;
     Metadata = metadata;
 }
예제 #15
0
 public SerializedEvent(
     string serializedMetadata,
     string serializedData,
     int aggregateSequenceNumber,
     IMetadata metadata)
 {
     SerializedMetadata = serializedMetadata;
     SerializedData = serializedData;
     AggregateSequenceNumber = aggregateSequenceNumber;
     Metadata = metadata;
 }
예제 #16
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        /// <param name="path">
        /// Path to the raster file that represents the map.
        /// </param>
        /// <param name="ecoregions">
        /// The dataset of ecoregions that are in the map.
        /// </param>
        /// <param name="rasterFactory">
        /// The raster factory to use to read the map.
        /// </param>
        public Map(string         path,
                   IDataset       ecoregions,
                   IRasterFactory rasterFactory)
        {
            this.path = path;
            this.ecoregions = ecoregions;
            this.rasterFactory = rasterFactory;
            IInputRaster<Pixel> map = rasterFactory.OpenRaster<Pixel>(path);
            using (map) {
                this.metadata = map.Metadata;
            }
        }
 /// <summary>
 /// Open a writer on a new file
 /// </summary>
 public WritableImage(string filename,
                      Dimensions dimensions,
                      int bandCount,
                      System.TypeCode bandType,
                      IMetadata metadata)
   : base(filename, dimensions, bandCount, bandType, metadata)
 {
     this.pixelsWritten = 0;
     
     // open file for writing
     this.file = new FileStream(filename,FileMode.Open);
     this.fileWriter = new BinaryWriter(this.file);
    
 }
예제 #18
0
 public Task Serialize(IMetadata metadata, JsonWriter writer)
 {
     if (metadata == null)
     {
         writer.WriteNull();
     }
     else
     {
         if (metadata.MetaObject == null)
             throw new JsonSerializationException("The meta object cannot be null.");
         metadata.MetaObject.WriteTo(writer);
     }
     return Task.FromResult(0);
 }
예제 #19
0
        /// <summary>
        /// Destroys the metadata root.
        /// </summary>
        /// <param name="metadata">The metadata.</param>
        public void DestroyMetadataRoot( IMetadata metadata )
        {
            if ( metadata == null )
            {
                throw new ArgumentNullException ( "metadata" );
            }

            if ( !( metadata is MetadataRoot ) )
            {
                throw new ArgumentException ( "metadata should be MetadataRoot.", "metadata" );
            }

            _metadataRepository.MakeTransient ( metadata );
        }
예제 #20
0
 /// <summary>
 /// Fully specified constructor - used before calling Write()
 /// </summary>
 /// <remark>
 /// Usually used before calling Write() but could call NoArg constructor,
 /// Read(), and then Write() if copying images
 /// </remark>
 public ImageHeader(Dimensions dimensions, System.TypeCode bandType,
                         int bandCount, IMetadata metadata)
 {
     this.dimensions = dimensions;
     this.bandType   = bandType;
     this.bandCount  = bandCount;
     this.metadata   = metadata as Metadata;
     if (bandType == System.TypeCode.Byte)
         this.bandSize   = 1;
     else if (bandType == System.TypeCode.UInt16)
         this.bandSize   = 2;
     else
         throw new ApplicationException("ImageHeader: bandType must either be Byte or UInt16");
 }
예제 #21
0
 /// <summary>
 /// Initializes a new instance of <see cref="ViewContext"/>.
 /// </summary>
 /// <param name="actionContext">The <see cref="ActionContext"/>.</param>
 /// <param name="view">The <see cref="IView"/> being rendered.</param>
 /// <param name="viewData">The <see cref="ViewDataDictionary"/>.</param>
 /// <param name="tempData">The <see cref="ITempDataDictionary"/>.</param>
 /// <param name="writer">The <see cref="TextWriter"/> to render output to.</param>
 public ViewContext(
     [NotNull] IView view,
     [NotNull] ViewDataDictionary viewData,
     [NotNull] TextWriter writer,
     IMetadata metadata,
     IExecutionContext executionContext,
     IViewEngine viewEngine)
 {
     View = view;
     ViewData = viewData;
     Writer = writer;
     Metadata = metadata;
     ExecutionContext = executionContext;
     ViewEngine = viewEngine;
 }
        protected MediaItemViewModel(IMetadataController controller, IMetadata item, string type, object icon)
        {
            if (controller == null)
                throw new ArgumentNullException("controller");
            if (item == null)
                throw new ArgumentNullException("item");
            if (type == null)
                throw new ArgumentNullException("type");
            if (icon == null)
                throw new ArgumentNullException("icon");

            this.controller = controller;
            this.item = item;
            this.type = type;
            this.icon = icon;
        }
 public async Task LoadMedia(
     string mediaUrl,
     string contentType = "application/vnd.ms-sstr+xml",
     IMetadata metadata = null,
     string streamType = "BUFFERED",
     double duration = 0D,
     object customData = null,
     Track[] tracks = null,
     int[] activeTrackIds = null,
     bool autoPlay = true,
     double currentTime = 0.0)
 {
     await
         Client.MediaChannel.LoadMedia(mediaUrl, contentType, metadata, streamType, duration, customData, tracks,
             activeTrackIds, autoPlay, currentTime);
 }
예제 #24
0
 private void TryCtor(string filename,
                      Dimensions dimensions,
                      int bandCount,
                      System.TypeCode bandType,
                      IMetadata metadata)
 {
     try {
         Image image = new Image(filename, dimensions,
                                  bandCount, bandType,
                                  metadata);
     }
     catch (System.Exception exc) {
         Data.Output.WriteLine(exc.Message);
         throw;
     }
 }
예제 #25
0
파일: methods.cs 프로젝트: Pavel-Durov/msos
        internal static DesktopMethod Create(DesktopRuntimeBase runtime, IMetadata metadata, IMethodDescData mdData)
        {
            if (mdData == null)
                return null;

            MethodAttributes attrs = (MethodAttributes)0;
            if (metadata != null)
            {
                int pClass, methodLength;
                uint blobLen, codeRva, implFlags;
                IntPtr blob;
                if (metadata.GetMethodProps(mdData.MDToken, out pClass, null, 0, out methodLength, out attrs, out blob, out blobLen, out codeRva, out implFlags) < 0)
                    attrs = (MethodAttributes)0;
            }

            return new DesktopMethod(runtime, mdData.MethodDesc, mdData, attrs);
        }
예제 #26
0
        public async Task LoadMedia(
            string mediaUrl,
            string contentType = "application/vnd.ms-sstr+xml",
            IMetadata metadata = null,
            string streamType = "BUFFERED",
            double duration = 0D,
            object customData = null,
            Track[] tracks = null,
            int[] activeTrackIds = null,
            bool autoPlay = true,
            double currentTime = 0.0)
        {
            var mediaObject = new MediaData(mediaUrl, contentType, metadata, streamType, duration, customData, tracks);
            var req = new LoadRequest(Client.CurrentApplicationSessionId, mediaObject, autoPlay, currentTime, customData, activeTrackIds);

            var reqJson = req.ToJson();
            await Write(MessageFactory.Load(Client.CurrentApplicationTransportId, reqJson));
        }
예제 #27
0
파일: Entity.cs 프로젝트: 2sic/eav-server
        /// <summary>
        /// Create a new Entity
        /// </summary>
        public Entity(Guid entityGuid, int entityId, int repositoryId, IMetadata metadata /* int assignmentObjectTypeId */, IContentType type, bool isPublished, IEnumerable<EntityRelationshipItem> allRelationships, DateTime modified, string owner)
        {
            EntityId = entityId;
            EntityGuid = entityGuid;
            Metadata = metadata;
            AssignmentObjectTypeId = Metadata.TargetType;// assignmentObjectTypeId;
            Attributes = new Dictionary<string, IAttribute>(StringComparer.OrdinalIgnoreCase); // 2015-04-24 added, maybe a risk but should help with tokens
            Type = type;
            IsPublished = isPublished;
            RepositoryId = repositoryId;
            Modified = modified;

            if (allRelationships == null)
                allRelationships = new List<EntityRelationshipItem>();
            Relationships = new RelationshipManager(this, allRelationships);

            Owner = owner;
        }
예제 #28
0
파일: modules.cs 프로젝트: JeffCyr/clrmd
        public DesktopModule(DesktopRuntimeBase runtime, ulong address, IModuleData data, string name, string assemblyName, ulong size)
            : base(runtime)
        {
            Revision = runtime.Revision;
            _imageBase = data.ImageBase;
            _assemblyName = assemblyName;
            _isPE = data.IsPEFile;
            _reflection = data.IsReflection || string.IsNullOrEmpty(name) || !name.Contains("\\");
            _name = name;
            ModuleId = data.ModuleId;
            ModuleIndex = data.ModuleIndex;
            _metadataStart = data.MetdataStart;
            _metadataLength = data.MetadataLength;
            _assemblyAddress = data.Assembly;
            _size = size;

            if (!runtime.DataReader.IsMinidump)
            {
                // This is very expensive in the minidump case, as we may be heading out to the symbol server or
                // reading multiple files from disk. Only optimistically fetch this data if we have full memory.
                _metadata = data.LegacyMetaDataImport as IMetadata;
            }
            else
            {
                // If we are a minidump and metadata isn't mapped in, attempt to fetch this module from the symbol server
                // on a background thread.
#if !V2_SUPPORT
                if (_isPE && _metadataStart != 0 && _metadataLength > 0)
                {
                    int read;
                    byte[] tmp = new byte[1];
                    if (!_runtime.DataReader.ReadMemory(_metadataStart, tmp, 1, out read) || read == 0)
                    {
                        int filesize, imagesize;
                        if (PEFile.TryGetIndexProperties(new ReadVirtualStream(_runtime.DataReader, (long)data.ImageBase, (long)size), true, out imagesize, out filesize))
                            _runtime.DataTarget.SymbolLocator.PrefetchBinary(Path.GetFileName(assemblyName), imagesize, filesize);
                    }
                }
#endif
            }
        }
예제 #29
0
 public object Get(IMetadata metadata)
 {
     if (!_cached)
     {
         if (_symbol == null)
         {
             _value = null;
         }
         else if (!_visitor.TryGetDocument(_symbol, out _value))
         {
             // Visit the symbol and try again
             _symbol.Accept(_visitor);
             if (!_visitor.TryGetDocument(_symbol, out _value))
             {
                 _value = null;
             }
         }
         _cached = true;
     }
     return _value;
 }
예제 #30
0
 public object Get(string key, IMetadata metadata)
 {
     if (!_cached)
     {
         _values = _symbols
             .Where(x => x != null)
             .Select(x =>
             {
                 IDocument document;
                 if (!_visitor.TryGetDocument(x, out document))
                 {
                     // Visit the symbol and try again
                     x.Accept(_visitor);
                     return !_visitor.TryGetDocument(x, out document) ? null : document;
                 }
                 return document;
             })
             .Where(x => x != null)
             .ToImmutableArray();
         _cached = true;
     }
     return _values;
 }
예제 #31
0
 public MetadataRoles30(IMetadata metadata, ISqlHelper sqlHelper)
     : base(metadata, sqlHelper)
 {
 }
예제 #32
0
 internal MetadataStream(IMetadata metadata, int index) : this(metadata, metadata.StreamHeaders[index])
 {
 }
예제 #33
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='category'>
 /// </param>
 /// <param name='collection'>
 /// </param>
 /// <param name='model'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task BulkUpdateAsync(this IMetadata operations, string category, string collection, IDictionary <string, MetadataModel> model = default(IDictionary <string, MetadataModel>), CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.BulkUpdateWithHttpMessagesAsync(category, collection, model, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
 public MetadataFunctions25(IMetadata metadata, ISqlHelper sqlHelper)
     : base(metadata, sqlHelper)
 {
 }
 public virtual IEnumerable <CommandGroup> AlterNewFunctionsToEmptyBodyForAlteringOrDropping(IMetadata other, IComparerContext context)
 {
     yield break;
 }
예제 #36
0
 public EventEnvelope(T @event, IMetadata metadata)
 {
     Ensure.Any.IsNotNull(@event);
     Event    = @event;
     Metadata = metadata;
 }
 public IEnumerable <CommandGroup> AlterLegacyFunctions(IMetadata other, IComparerContext context)
 {
     return(FilterSystemFlagUser(LegacyFunctionsByName.Values)
            .Where(f => other.MetadataFunctions.LegacyFunctionsByName.TryGetValue(f.FunctionNameKey, out var otherFunction) && otherFunction != f)
            .Select(f => new CommandGroup().Append(f.Alter(Metadata, other, context))));
 }
예제 #38
0
 /// <summary>
 /// 初始化插件类。
 /// </summary>
 /// <remarks>
 /// 此方法将由 SiteServer CMS 系统载入插件时调用。
 /// </remarks>
 /// <param name="metadata">插件元数据接口。</param>
 public virtual void Initialize(IMetadata metadata)
 {
 }
예제 #39
0
 private void MessageProvider_MetaReceived(object sender, IMetadata e)
 {
     MetadataUpdated?.Invoke(this, e);
 }
예제 #40
0
        public string GetLink(IMetadata metadata, string key, bool includeHost = false)
        {
            FilePath filePath = metadata?.FilePath(key);

            return(filePath != null?GetLink(filePath, includeHost) : null);
        }
예제 #41
0
 public string GetLink(IMetadata metadata, bool includeHost = false) =>
 GetLink(metadata, Common.Meta.Keys.RelativeFilePath, includeHost);
예제 #42
0
 public MetadataNotValidatedYetException(string message, IMetadata metadata)
     : this(message, metadata, (Exception)null)
 {
 }
예제 #43
0
 public MetadataNotValidatedYetException(IMetadata metadata, Exception innerException)
     : this(message : null, metadata : metadata, innerException : innerException)
 {
 }
예제 #44
0
 public MetadataNotValidatedYetException(string message, IMetadata metadata, Exception innerException)
     : base(message : string.IsNullOrEmpty(message) ? FormatXResource(typeof(MetadataNotValidatedYetException), "DefaultMessage", metadata) : FormatXResource(typeof(MetadataNotValidatedYetException), "UserMessage", message, metadata), innerException : innerException)
 {
     _metadata = metadata;
 }
예제 #45
0
 private List <MetadataFile> GetMetadataFilesForConsumer(IMetadata consumer, List <MetadataFile> movieMetadata)
 {
     return(movieMetadata.Where(c => c.Consumer == consumer.GetType().Name).ToList());
 }
예제 #46
0
    private IEnumerable <Command> CreateConstraints(Func <IMetadataConstraints, IMetadataConstraints, RelationConstraint, bool> predicate, IMetadata other, IComparerContext context)
    {
        var commands =
            RelationConstraintsByName
            .Values
            .Where(rc => predicate(Metadata.MetadataConstraints, other.MetadataConstraints, rc))
            .OrderBy(rc => rc.RelationName)
            .ThenBy(rc => rc.ConstraintName)
            .SelectMany(c => c.Create(Metadata, other, context));

        return(commands);
    }
        public IEnumerable <KeyValuePair <string, string> > ProvideMetadata <TAggregate, TIdentity>(TIdentity id,
                                                                                                    IAggregateEvent aggregateEvent, IMetadata metadata) where TAggregate : IAggregateRoot <TIdentity>
            where TIdentity : IIdentity
        {
            var user = _httpContextAccessor.HttpContext?.User;

            if (user == null)
            {
                return(Enumerable.Empty <KeyValuePair <string, string> >());
            }

            return(from claim in user.Claims
                   where _options.IsIncluded(claim.Type)
                   group claim by claim.Type
                   into claimGroup
                   let key = _options.GetKeyForClaimType(claimGroup.Key)
                             let values = claimGroup.Select(c => c.Value)
                                          let joinedValues = string.Join(";", values)
                                                             select new KeyValuePair <string, string>(key, joinedValues));
        }
예제 #48
0
    private IEnumerable <Command> DropConstraints(Func <IMetadataConstraints, IMetadataConstraints, RelationConstraint, bool> predicate, IMetadata other, IComparerContext context)
    {
        var constraintsToBeDropped =
            other
            .MetadataConstraints
            .RelationConstraintsByName
            .Values
            .Where(c => predicate(other.MetadataConstraints, Metadata.MetadataConstraints, c))
            .Where(c => !context.DroppedObjects.Contains(c.TypeObjectNameKey))
            .OrderBy(rc => rc.RelationName)
            .ThenBy(rc => rc.ConstraintName);

        foreach (var constraint in constraintsToBeDropped)
        {
            if (constraint.RelationConstraintType == RelationConstraintType.PrimaryKey || constraint.RelationConstraintType == RelationConstraintType.Unique)
            {
                if (ReferenceConstraintsByNameUq.TryGetValue(constraint.ConstraintName, out var referenceConstraints))
                {
                    var dependencies =
                        referenceConstraints
                        .Select(rc => ReferenceConstraintsByName[rc.ConstraintName])
                        .Where(rc => other.MetadataConstraints.ReferenceConstraintsByName.ContainsKey(rc.ConstraintName))
                        .Where(rc => !context.DroppedObjects.Contains(rc.TypeObjectNameKey));
                    foreach (var item in dependencies.SelectMany(d => d.RelationConstraint.Drop(Metadata, other, context)))
                    {
                        yield return(item);
                    }
                }
                else
                {
                    var constraintFields = constraint.Index.Segments.Select(x => x.RelationField.TypeObjectNameKey);
                    if (constraintFields.All(x => context.DroppedObjects.Contains(x)))
                    {
                        continue;
                    }
                }
            }
            foreach (var item in constraint.Drop(Metadata, other, context))
            {
                yield return(item);
            }
        }
    }
예제 #49
0
 public LeaseOrPurchaseViewModel(string assetsPrefix, IMetadata metadata)
     : base(assetsPrefix, metadata)
 {
 }
예제 #50
0
 public MetadataConstraints25(IMetadata metadata, ISqlHelper sqlHelper)
     : base(metadata, sqlHelper)
 {
 }
 public IEnumerable <CommandGroup> CreateLegacyFunctions(IMetadata other, IComparerContext context)
 {
     return(FilterSystemFlagUser(LegacyFunctionsByName.Values)
            .Where(f => !other.MetadataFunctions.LegacyFunctionsByName.ContainsKey(f.FunctionNameKey))
            .Select(f => new CommandGroup().Append(f.Create(Metadata, other, context))));
 }
예제 #52
0
    public IEnumerable <Command> DropConstraintsForDependenciesHelper(Func <IndexSegment, bool> selector, IMetadata other, IComparerContext context)
    {
        var relationConstraints =
            other
            .MetadataConstraints
            .RelationConstraintsByName
            .Values
            .Where(c => (c.RelationConstraintType == RelationConstraintType.PrimaryKey ||
                         c.RelationConstraintType == RelationConstraintType.Unique ||
                         c.RelationConstraintType == RelationConstraintType.ForeignKey) &&
                   c.Index.Segments.Any(selector))
            .Where(c => !context.DroppedObjects.Contains(c.TypeObjectNameKey))
            .OrderBy(c => c.RelationConstraintType == RelationConstraintType.PrimaryKey ||
                     c.RelationConstraintType == RelationConstraintType.Unique);

        foreach (var relationConstraint in relationConstraints)
        {
            if (relationConstraint.RelationConstraintType == RelationConstraintType.PrimaryKey || relationConstraint.RelationConstraintType == RelationConstraintType.Unique)
            {
                if (other.MetadataConstraints.ReferenceConstraintsByNameUq.TryGetValue(relationConstraint.ConstraintName, out var referenceConstraints))
                {
                    var dependencies = referenceConstraints
                                       .Select(rc => other.MetadataConstraints.ReferenceConstraintsByName[rc.ConstraintName])
                                       .Where(rc => !context.DroppedObjects.Contains(rc.RelationConstraint.TypeObjectNameKey));
                    foreach (var command in dependencies.SelectMany(d => d.RelationConstraint.Drop(Metadata, other, context)))
                    {
                        yield return(command);
                    }
                }
            }

            foreach (var command in relationConstraint.Drop(Metadata, other, context))
            {
                yield return(command);
            }
        }
    }
 public virtual IEnumerable <CommandGroup> DropNewFunctions(IMetadata other, IComparerContext context)
 {
     yield break;
 }
 public MetadataProcedures40(IMetadata metadata, ISqlHelper sqlHelper)
     : base(metadata, sqlHelper)
 {
 }
 public virtual IEnumerable <CommandGroup> AlterNewFunctionsToFullBody(IMetadata other, IComparerContext context)
 {
     yield break;
 }
예제 #56
0
 public abstract IEnumerable <KeyValuePair <string, string> > ProvideMetadata
 <TAggregate, TIdentity>(TIdentity id, IAggregateEvent aggregateEvent, IMetadata metadata)
     where TAggregate : IAggregateRoot <TIdentity> where TIdentity : IIdentity;
예제 #57
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='category'>
 /// </param>
 /// <param name='collection'>
 /// </param>
 /// <param name='key'>
 /// </param>
 /// <param name='model'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task AddAsync(this IMetadata operations, string category, string collection, string key, MetadataModel model = default(MetadataModel), CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.AddWithHttpMessagesAsync(category, collection, key, model, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
예제 #58
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='category'>
 /// </param>
 /// <param name='collection'>
 /// </param>
 /// <param name='keys'>
 /// </param>
 /// <param name='keyword'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IDictionary <string, IDictionary <string, string> > > FindByKeysAsync(this IMetadata operations, string category, string collection, IList <string> keys = default(IList <string>), string keyword = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.FindByKeysWithHttpMessagesAsync(category, collection, keys, keyword, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
예제 #59
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='category'>
 /// </param>
 /// <param name='collection'>
 /// </param>
 /// <param name='key'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task RemoveAsync(this IMetadata operations, string category, string collection, string key, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.RemoveWithHttpMessagesAsync(category, collection, key, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
예제 #60
0
 public UncommittedEvent(IAggregateEvent aggregateEvent, IMetadata metadata)
 {
     AggregateEvent = aggregateEvent;
     Metadata       = metadata;
 }