コード例 #1
0
        private int FindCreateArtifactType(ArtifactType artifactType)
        {
            using (RuntimeEntityModel context = RuntimeEntityModel.CreateInstance())
            {
                if (string.IsNullOrEmpty(artifactType.ReferenceName))
                {
                    throw new ArgumentException(string.Format(MigrationToolkitResources.MissingArtifactTypeRefName));
                }


                if (string.IsNullOrEmpty(artifactType.FriendlyName))
                {
                    throw new ArgumentException(string.Format(MigrationToolkitResources.MissingArtifactTypeDispName));
                }

                var artifactTypeQuery = from t in context.RTArtifactTypeSet
                                        where t.ReferenceName.Equals(artifactType.ReferenceName) &&
                                        t.DisplayName.Equals(artifactType.FriendlyName) &&
                                        t.ArtifactContentType.Equals(artifactType.ContentTypeReferenceName)
                                        select t;

                if (artifactTypeQuery.Count() > 0)
                {
                    return(artifactTypeQuery.First().Id);
                }

                var newType = RTArtifactType.CreateRTArtifactType(0, artifactType.ReferenceName, artifactType.FriendlyName,
                                                                  artifactType.ContentTypeReferenceName);
                context.AddToRTArtifactTypeSet(newType);
                context.TrySaveChanges();
                return(newType.Id);
            }
        }
コード例 #2
0
 protected ComplexLinkType(
     string referenceName,
     string friendlyName,
     ArtifactType sourceArtifactType,
     ArtifactType targetArtifactType,
     ExtendedLinkProperties extendedLinkProperties)
     : base(referenceName, friendlyName, sourceArtifactType, targetArtifactType)
 {
     if (null == extendedLinkProperties)
     {
         throw new ArgumentNullException("extendedLinkProperties");
     }
     ExtendedProperties = extendedLinkProperties;
 }
コード例 #3
0
        public Artifact(string uri, ArtifactType artifactType)
        {
            if (null == uri)
            {
                throw new ArgumentNullException("uri");
            }

            if (null == artifactType)
            {
                throw new ArgumentNullException("artifactType");
            }

            Uri          = uri;
            ArtifactType = artifactType;
        }
コード例 #4
0
        public LinkType(
            string referenceName,
            string friendlyName,
            ArtifactType sourceArtifactType,
            ArtifactType targetArtifactType,
            ExtendedLinkProperties extendedLinkProperties)
        {
            if (string.IsNullOrEmpty(referenceName))
            {
                throw new ArgumentNullException("referenceName");
            }

            if (string.IsNullOrEmpty(friendlyName))
            {
                throw new ArgumentNullException("friendlyName");
            }

            if (null == sourceArtifactType)
            {
                throw new ArgumentNullException("sourceArtifactType");
            }

            if (null == targetArtifactType)
            {
                throw new ArgumentNullException("targetArtifactType");
            }

            if (null == extendedLinkProperties)
            {
                throw new ArgumentNullException("extendedLinkProperties");
            }

            ReferenceName      = referenceName;
            FriendlyName       = friendlyName;
            SourceArtifactType = sourceArtifactType;
            TargetArtifactType = targetArtifactType;
            ExtendedProperties = extendedLinkProperties;
        }