예제 #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;
        }