示例#1
0
        /// <summary>
        /// Gets the connect time property.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public DictionaryProperty GetConnectTimeProperty(string name)
        {
            if (this.State != FdoConnectionState.Open && this.State != FdoConnectionState.Pending)
            {
                throw new InvalidOperationException(Res.GetString("ERR_CONNECTION_NOT_OPEN"));
            }

            IConnectionPropertyDictionary dict = this.InternalConnection.ConnectionInfo.ConnectionProperties;
            bool enumerable       = dict.IsPropertyEnumerable(name);
            DictionaryProperty dp = null;

            if (enumerable)
            {
                EnumerableDictionaryProperty ep = new EnumerableDictionaryProperty();
                ep.Values = dict.EnumeratePropertyValues(name);
                dp        = ep;
            }
            else
            {
                dp = new DictionaryProperty();
            }

            dp.Name          = name;
            dp.LocalizedName = dict.GetLocalizedName(name);
            dp.DefaultValue  = dict.GetPropertyDefault(name);
            dp.Protected     = dict.IsPropertyProtected(name);
            dp.Required      = dict.IsPropertyRequired(name);

            return(dp);
        }
示例#2
0
        /// <summary>
        /// Utility method to clone a class definition
        /// </summary>
        /// <param name="cd">The class to clone.</param>
        /// <param name="ignoreDeleted">if set to <c>true</c> [ignore deleted].</param>
        /// <returns></returns>
        public static ClassDefinition CloneClass(ClassDefinition cd, bool ignoreDeleted)
        {
            ClassDefinition classDef = null;

            switch (cd.ClassType)
            {
            case ClassType.ClassType_Class:
            {
                Class c = new Class(cd.Name, cd.Description);
                CopyProperties(cd.Properties, c.Properties, ignoreDeleted);
                CopyIdentityProperties(cd.IdentityProperties, c.IdentityProperties, ignoreDeleted);
                CopyElementAttributes(cd.Attributes, c.Attributes);
                CopyUniqueConstraints(cd.UniqueConstraints, c);
                classDef = c;
            }
            break;

            case ClassType.ClassType_FeatureClass:
            {
                FeatureClass sfc = (FeatureClass)cd;
                FeatureClass fc  = new FeatureClass(cd.Name, cd.Description);
                CopyProperties(cd.Properties, fc.Properties, ignoreDeleted);
                CopyIdentityProperties(cd.IdentityProperties, fc.IdentityProperties, ignoreDeleted);
                if (sfc.GeometryProperty != null)
                {
                    string geomName = sfc.GeometryProperty.Name;
                    fc.GeometryProperty = fc.Properties[fc.Properties.IndexOf(geomName)] as GeometricPropertyDefinition;
                }
                CopyElementAttributes(cd.Attributes, fc.Attributes);
                CopyUniqueConstraints(cd.UniqueConstraints, fc);
                classDef = fc;
            }
            break;

            default:
                throw new UnsupportedException(Res.GetStringFormatted("ERR_UNSUPPORTED_CLONE_CLASS_TYPE", cd.ClassType));
            }
            return(classDef);
        }