Exemplo n.º 1
0
        private static IEnumerable <IField> CreateFields()
        {
            yield return(FieldUtils.CreateOIDField());

            yield return(FieldUtils.CreateDoubleField(_doubleFieldName));

            yield return(FieldUtils.CreateDateField(_dateFieldName));

            yield return(FieldUtils.CreateTextField(_textFieldName, 500));

            yield return(FieldUtils.CreateTextField(_stateFieldName, 2));
        }
Exemplo n.º 2
0
        private IFeatureClass CreateFeatureClass(string name, esriGeometryType geometryType)
        {
            IFieldsEdit fields = new FieldsClass();

            fields.AddField(FieldUtils.CreateOIDField());
            fields.AddField(FieldUtils.CreateShapeField(
                                "Shape", geometryType, _spatialReference, 1000));

            fields.AddField(FieldUtils.CreateTextField(_stateIdFieldName, 100));

            fields.AddField(FieldUtils.CreateTextField(_textFieldName, 200));
            fields.AddField(FieldUtils.CreateDoubleField(_doubleFieldName));
            fields.AddField(FieldUtils.CreateDateField(_dateFieldName));

            return(DatasetUtils.CreateSimpleFeatureClass(
                       _featureWorkspace, name, fields));
        }
Exemplo n.º 3
0
        public void CanCreateDateTimeRangeDomainConstraintNotNull()
        {
            IRangeDomain dateRangeDomain = DomainUtils.CreateRangeDomain(
                "CanCreateDateTimeRangeDomainConstraintNotNull",
                esriFieldType.esriFieldTypeDate,
                new DateTime(2011, 12, 31),
                new DateTime(2012, 1, 31, 23, 55, 59));

            DomainUtils.AddDomain(_testWs, dateRangeDomain);

            IField dateField = FieldUtils.CreateDateField("DateField");

            ((IFieldEdit)dateField).Domain_2 = (IDomain)dateRangeDomain;

            ITable table = DatasetUtils.CreateTable(_testWs,
                                                    "CanCreateDateTimeRangeDomainConstraintNotNull",
                                                    FieldUtils.CreateOIDField(),
                                                    dateField);

            List <ConstraintNode> constraints =
                GdbConstraintUtils.GetGdbConstraints(
                    table, allowNullForRangeDomains: false);

            Assert.NotNull(constraints);

            foreach (ConstraintNode constraint in constraints)
            {
                Console.WriteLine(constraint);
            }

            Assert.AreEqual(2, constraints.Count);

            Assert.AreEqual(
                "DateField >= #12/31/2011 00:00:00# AND DateField <= #01/31/2012 23:55:59#",
                constraints[0].Condition);
            Assert.AreEqual("OBJECTID >= 0", constraints[1].Condition);
        }