当前位置: 首页>>代码示例>>C#>>正文


C# DomainObject.GetType方法代码示例

本文整理汇总了C#中DomainObject.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# DomainObject.GetType方法的具体用法?C# DomainObject.GetType怎么用?C# DomainObject.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DomainObject的用法示例。


在下文中一共展示了DomainObject.GetType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: unregisterDomainObject

 public void unregisterDomainObject(DomainObject domainObject)
 {
     Hashtable typeMap = (Hashtable)m_typeMaps[domainObject.GetType().BaseType];
     if(typeMap == null)
         Debug.Assert(false);
     Debug.Assert(typeMap.Contains(domainObject.Id));
     typeMap.Remove(domainObject.Id);
 }
开发者ID:eglimi,项目名称:storm,代码行数:8,代码来源:IdentityMap.cs

示例2: IsPersistent

 public static bool IsPersistent(DomainObject entity)
 {
     var keyAttributedProps =
         entity.GetType()
             .GetProperties()
             .FirstOrDefault(p => p.GetCustomAttributes(typeof (KeyAttribute), true).Length == 1);
     return (keyAttributedProps != null) && !keyAttributedProps.GetValue(entity, null).ToString().Equals("0");
 }
开发者ID:rodmjay,项目名称:ScaffR-Generated,代码行数:8,代码来源:UnitOfWork.cs

示例3: Remove

        public void Remove(DomainObject item)
        {
            if(item == Person.None) return;
            if (_domainObjects.Contains(item) == false) return;  // Already exists

            IList bindingList = _bindingLists[item.GetType()];

            bindingList.Remove(item);
            _domainObjects.Remove(item);
        }
开发者ID:LayCraft,项目名称:comp_157,代码行数:10,代码来源:MovieRepository.cs

示例4: registerDomainObject

 public void registerDomainObject(DomainObject domainObject)
 {
     Type type = domainObject.GetType().BaseType;
     Hashtable typeMap = (Hashtable)m_typeMaps[type];
     if(typeMap == null)
     {
         typeMap = new Hashtable();
         m_typeMaps[type] = typeMap;
     }
     Debug.Assert(typeMap.Contains(domainObject) == false);
     typeMap.Add(domainObject.Id, domainObject);
 }
开发者ID:eglimi,项目名称:storm,代码行数:12,代码来源:IdentityMap.cs

示例5: Add

        public void Add(DomainObject item)
        {
            if(item == null) return;

            if (_domainObjects.Contains(item)) return;  // Already exists

            IList bindingList = _bindingLists[item.GetType()];

            Movie pet = item as Movie;
            if (pet != null)
            {
                Add(pet.Director);
            }

            bindingList.Add(item);
            _domainObjects.Add(item);
        }
开发者ID:LayCraft,项目名称:comp_157,代码行数:17,代码来源:MovieRepository.cs

示例6: GetPropertyValue

 /// <summary>
 /// Gets value for given business object's property using reflection.
 /// </summary>
 protected object GetPropertyValue(DomainObject domainObject)
 {
     return domainObject.GetType().GetProperty(PropertyName).GetValue(domainObject, null);
 }
开发者ID:dzstoever,项目名称:ZenFacades,代码行数:7,代码来源:ValidateRule.cs

示例7: Validate

        public override bool Validate(DomainObject domainObject)
        {
            try
            {
                string propValue1 = domainObject.GetType().GetProperty(PropertyName).GetValue(domainObject, null).ToString();
                string propValue2 = domainObject.GetType().GetProperty(OtherPropertyName).GetValue(domainObject, null).ToString();

                switch(DataType)
                {
                    case ValidationDataType.Integer:

                        int ival1 = int.Parse(propValue1);
                        int ival2 = int.Parse(propValue2);

                        switch(Operator)
                        {
                            case ValidationOperator.Equal: return ival1 == ival2;
                            case ValidationOperator.NotEqual: return ival1 != ival2;
                            case ValidationOperator.GreaterThan: return ival1 > ival2;
                            case ValidationOperator.GreaterThanEqual: return ival1 >= ival2;
                            case ValidationOperator.LessThan: return ival1 < ival2;
                            case ValidationOperator.LessThanEqual: return ival1 <= ival2;
                        }
                        break;

                    case ValidationDataType.Double:

                        double dval1 = double.Parse(propValue1);
                        double dval2 = double.Parse(propValue2);

                        switch(Operator)
                        {
                            case ValidationOperator.Equal: return dval1 == dval2;
                            case ValidationOperator.NotEqual: return dval1 != dval2;
                            case ValidationOperator.GreaterThan: return dval1 > dval2;
                            case ValidationOperator.GreaterThanEqual: return dval1 >= dval2;
                            case ValidationOperator.LessThan: return dval1 < dval2;
                            case ValidationOperator.LessThanEqual: return dval1 <= dval2;
                        }
                        break;

                    case ValidationDataType.Decimal:

                        decimal cval1 = decimal.Parse(propValue1);
                        decimal cval2 = decimal.Parse(propValue2);

                        switch(Operator)
                        {
                            case ValidationOperator.Equal: return cval1 == cval2;
                            case ValidationOperator.NotEqual: return cval1 != cval2;
                            case ValidationOperator.GreaterThan: return cval1 > cval2;
                            case ValidationOperator.GreaterThanEqual: return cval1 >= cval2;
                            case ValidationOperator.LessThan: return cval1 < cval2;
                            case ValidationOperator.LessThanEqual: return cval1 <= cval2;
                        }
                        break;

                    case ValidationDataType.Date:

                        DateTime tval1 = DateTime.Parse(propValue1);
                        DateTime tval2 = DateTime.Parse(propValue2);

                        switch(Operator)
                        {
                            case ValidationOperator.Equal: return tval1 == tval2;
                            case ValidationOperator.NotEqual: return tval1 != tval2;
                            case ValidationOperator.GreaterThan: return tval1 > tval2;
                            case ValidationOperator.GreaterThanEqual: return tval1 >= tval2;
                            case ValidationOperator.LessThan: return tval1 < tval2;
                            case ValidationOperator.LessThanEqual: return tval1 <= tval2;
                        }
                        break;

                    case ValidationDataType.String:

                        int result = string.Compare(propValue1, propValue2, StringComparison.CurrentCulture);

                        switch(Operator)
                        {
                            case ValidationOperator.Equal: return result == 0;
                            case ValidationOperator.NotEqual: return result != 0;
                            case ValidationOperator.GreaterThan: return result > 0;
                            case ValidationOperator.GreaterThanEqual: return result >= 0;
                            case ValidationOperator.LessThan: return result < 0;
                            case ValidationOperator.LessThanEqual: return result <= 0;
                        }
                        break;

                }
                return false;
            }
            catch{ return false; }
        }
开发者ID:dzstoever,项目名称:ZenFacades,代码行数:93,代码来源:ValidateCompare.cs


注:本文中的DomainObject.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。