Beispiel #1
0
        /// <summary>
        /// Returns a collection of business objects that are connected to
        /// this object through the specified relationship (eg. would return
        /// a father and a mother if the relationship was "parents").  This
        /// method is to be used in the case of multiple relationships.
        /// </summary>
        /// <param name="relationshipName">The name of the relationship</param>
        /// <returns>Returns a business object collection</returns>
        /// <exception cref="InvalidRelationshipAccessException">Thrown if
        /// the relationship specified is a single relationship, when a
        /// multiple one was expected</exception>
        public virtual IBusinessObjectCollection GetRelatedCollection(string relationshipName)
        {
            ArgumentValidationHelper.CheckStringArgumentNotEmpty(relationshipName, "relationshipName");
            IMultipleRelationship multipleRelationship = GetMultiple(relationshipName);

            return(multipleRelationship.BusinessObjectCollection);
        }
Beispiel #2
0
        ///<summary>
        /// Returns a multiple relationship for with the specified relationship name.
        ///</summary>
        ///<param name="relationshipName">The specified relationship name</param>
        ///<returns>The multiple relationship</returns>
        public IMultipleRelationship GetMultiple(string relationshipName)
        {
            ArgumentValidationHelper.CheckStringArgumentNotEmpty(relationshipName, "relationshipName");
            IMultipleRelationship relationship = GetRelationshipAsMultiple(relationshipName);

            return(relationship);
        }
Beispiel #3
0
        ///<summary>
        /// Returns a single relationship for with the specified relationship name.
        ///</summary>
        ///<param name="relationshipName">The specified relationship name</param>
        ///<returns>THe single relationship</returns>
        public ISingleRelationship GetSingle(string relationshipName)
        {
            ArgumentValidationHelper.CheckStringArgumentNotEmpty(relationshipName, "relationshipName");
            IRelationship relationship = GetRelationshipAsSingle(relationshipName);

            return((ISingleRelationship)relationship);
        }
Beispiel #4
0
        /// <summary>
        /// Returns the business object that is related to this object
        /// through the specified relationship (eg. would return a father
        /// if the relationship was called "father").  This method is to be
        /// used in the case of single relationships.
        /// </summary>
        /// <param name="relationshipName">The name of the relationship</param>
        /// <returns>Returns a business object</returns>
        /// <exception cref="InvalidRelationshipAccessException">Thrown if
        /// the relationship specified is a multiple relationship, when a
        /// single one was expected</exception>
        public IBusinessObject GetRelatedObject(string relationshipName)
        {
            ArgumentValidationHelper.CheckStringArgumentNotEmpty(relationshipName, "relationshipName");
            ISingleRelationship relationship = GetSingle(relationshipName);

            return(relationship.GetRelatedObject());
        }
Beispiel #5
0
        /// <summary>
        /// Returns the business object that is related to this object
        /// through the specified relationship (eg. would return a father
        /// if the relationship was called "father").  This method is to be
        /// used in the case of single relationships.
        /// </summary>
        /// <param name="relationshipName">The name of the relationship</param>
        /// <returns>Returns a business object</returns>
        /// <exception cref="InvalidRelationshipAccessException">Thrown if
        /// the relationship specified is a multiple relationship, when a
        /// single one was expected</exception>
        public T GetRelatedObject <T>(string relationshipName) where T : class, IBusinessObject, new()
        {
            ArgumentValidationHelper.CheckStringArgumentNotEmpty(relationshipName, "relationshipName");
            SingleRelationship <T> relationship = GetSingle <T>(relationshipName);

            return(relationship.GetRelatedObject());
        }
Beispiel #6
0
        /// <summary>
        /// Executes a raw sql statement. BEWARE OF SQL INJECTION ATTACKS. Use for hardcoded sql only.
        /// </summary>
        /// <param name="sql">The sql statement to run as a scalar</param>
        /// <returns>The scalar result</returns>
        public object ExecuteRawSqlScalar(string sql)
        {
            ArgumentValidationHelper.CheckArgumentNotNull(sql, "sql");
            IDbConnection con = null;

            try
            {
                con = OpenConnection;
                var cmd = CreateCommand(con);
                cmd.CommandText = sql;
                return(cmd.ExecuteScalar());
            }
            catch (Exception ex)
            {
                Log.Log
                    ("Error reading database : " + Environment.NewLine
                    + ExceptionUtilities.GetExceptionString(ex, 10, true), LogCategory.Exception);
                Log.Log("Sql: " + sql, LogCategory.Exception);
                Console.WriteLine
                    (@"Error reading database : " + Environment.NewLine
                    + ExceptionUtilities.GetExceptionString(ex, 10, true));
                Console.WriteLine(@"Connect string: " + this.ErrorSafeConnectString());
                throw new DatabaseReadException
                          ("There was an error reading the database. Please contact your system administrator.",
                          "The command ExecuteScalar could not be completed.", ex, sql, ErrorSafeConnectString());
            }
            finally
            {
                if (con != null && con.State != ConnectionState.Closed)
                {
                    con.Close();
                }
            }
        }
Beispiel #7
0
        // 1、返回IQueryable<TEntity>使用延迟加载技术
        // 2、返回IEnumerable<TEntity>,需要把数据集加载到内存

        /// <summary>
        /// 检查实体是否存在
        /// </summary>
        /// <param name="predicate">查询条件表达式</param>
        /// <returns>是否存在</returns>
        public virtual bool CheckExists(Expression <Func <TEntity, bool> > predicate)
        {
            // 参数有效性检查
            ArgumentValidationHelper.CheckForNullReference(predicate, "传入的对象key为空");
            // 存在返回true,否则false
            return(EFContext.Set <TEntity>().Count(predicate) == 0 ? false :true);
        }
Beispiel #8
0
 /// <summary>
 /// 查找指定主键的实体记录
 /// </summary>
 /// <param name="key"> 指定主键 </param>
 /// <returns> 符合编号的记录,不存在返回null </returns>
 public virtual TEntity GetByKey(object key)
 {
     // 参数有效性检查
     ArgumentValidationHelper.CheckForNullReference(key, "传入的对象key为空");
     // 执行查询
     return(EFContext.Set <TEntity>().Find(key));
 }
Beispiel #9
0
 /// <summary>
 /// Constructor to create new RelPropDef object
 /// </summary>
 /// <param name="ownerClassPropDef">The property definition of the
 /// owner object</param>
 /// <param name="relatedObjectPropName">The property name of the
 /// related object</param>
 public RelPropDef(IPropDef ownerClassPropDef,
                   string relatedObjectPropName)
 {
     ArgumentValidationHelper.CheckArgumentNotNull(ownerClassPropDef, "ownerClassPropDef");
     OwnerPropDef         = ownerClassPropDef;
     RelatedClassPropName = relatedObjectPropName;
 }
Beispiel #10
0
        static async Task Main(string[] args)
        {
            //setup DI
            _serviceProvider = DependencyBuilderClient.Configure();

            //Parameters validation
            if (ArgumentValidationHelper.CheckParameters(args))
            {
                var cube1 = CubeFactory.BuildCube(args[0], args[1], args[2], args[3], args[4]);
                var cube2 = CubeFactory.BuildCube(args[5], args[6], args[7], args[8], args[9]);
                //Process execution
                if ((cube1 != null) && (cube2 != null))
                {
                    var service = _serviceProvider.GetService <ICubeService>();
                    if (service.IsIntersection(cube1, cube2))
                    {
                        ConsoleLogHelper.ShowInfoMessage($"Cubes intersect.", System.ConsoleColor.Green);
                        var volumeIntersecion = service.VolumeIntersection(cube1, cube2);
                        ConsoleLogHelper.ShowInfoMessage($"Intersected volume: {volumeIntersecion}", System.ConsoleColor.Green);
                    }
                    else
                    {
                        ConsoleLogHelper.ShowInfoMessage($"Cubes DON'T intersect.", System.ConsoleColor.Yellow);
                    }
                }
            }

            Console.WriteLine(string.Empty);
            Console.WriteLine("Press any key to close the application...");
            Console.ReadLine();
        }
Beispiel #11
0
        ///<summary>
        /// Returns a strongly typed multiple relationship for with the specified relationship name.
        ///</summary>
        ///<param name="relationshipName">The specified relationship name</param>
        ///<returns>The multiple relationship</returns>
        public MultipleRelationship <T> GetMultiple <T>(string relationshipName)
            where T : BusinessObject, new()
        {
            ArgumentValidationHelper.CheckStringArgumentNotEmpty(relationshipName, "relationshipName");
            IMultipleRelationship relationship = GetRelationshipAsMultiple(relationshipName);

            return((MultipleRelationship <T>)relationship);
        }
Beispiel #12
0
        /// <summary>
        /// Returns a collection of business objects that are connected to
        /// this object through the specified relationship (eg. would return
        /// a father and a mother if the relationship was "parents").  This
        /// method is to be used in the case of multiple relationships.
        /// </summary>
        /// <param name="relationshipName">The name of the relationship</param>
        /// <returns>Returns a business object collection</returns>
        /// <exception cref="InvalidRelationshipAccessException">Thrown if
        /// the relationship specified is a single relationship, when a
        /// multiple one was expected</exception>
        public BusinessObjectCollection <TBusinessObject> GetRelatedCollection <TBusinessObject>(string relationshipName)
            where TBusinessObject : BusinessObject, new()
        {
            ArgumentValidationHelper.CheckStringArgumentNotEmpty(relationshipName, "relationshipName");
            MultipleRelationship <TBusinessObject> multipleRelationship = GetMultiple <TBusinessObject>(relationshipName);

            return(multipleRelationship.BusinessObjectCollection);
        }
Beispiel #13
0
        ///<summary>
        /// Returns a strongly typed single relationship for with the specified relationship name.
        ///</summary>
        ///<param name="relationshipName">The specified relationship name</param>
        ///<returns>THe single relationship</returns>
        public SingleRelationship <T> GetSingle <T>(string relationshipName)
            where T : class, IBusinessObject, new()
        {
            ArgumentValidationHelper.CheckStringArgumentNotEmpty(relationshipName, "relationshipName");
            IRelationship relationship = GetRelationshipAsSingle(relationshipName);

            return((SingleRelationship <T>)relationship);
        }
Beispiel #14
0
 /// <summary>
 /// 批量插入实体记录集合
 /// </summary>
 /// <param name="entities"> 实体记录集合 </param>
 /// <param name="isSave"> 是否执行保存 </param>
 /// <returns> 操作影响的行数 </returns>
 public virtual int Insert(IEnumerable <TEntity> entities, bool isSave = true)
 {
     // 参数有效性检查
     ArgumentValidationHelper.CheckForNullReference(entities, "传入的对象t为空");
     // 对象加入仓储上下文(暂不提交数据库)
     EFContext.RegisterNew(entities);
     // 立即提交或暂缓执行
     return(isSave ? EFContext.Commit() : 0);
 }
Beispiel #15
0
 /// <summary>
 /// 更新实体记录
 /// </summary>
 /// <param name="entity"> 实体对象 </param>
 /// <param name="isSave"> 是否执行保存 </param>
 /// <returns> 操作影响的行数 </returns>
 public virtual int Update(TEntity entity, bool isSave = true)
 {
     // 参数有效性检查
     ArgumentValidationHelper.CheckForNullReference(entity, "传入的对象entity为空");
     // 对象加入仓储上下文(暂不提交数据库)
     EFContext.RegisterModified(entity);
     //TEntity entity0 = EFContext.
     // 立即提交或暂缓执行
     return(isSave ? EFContext.Commit() : 0);
 }
Beispiel #16
0
        /// <summary>
        /// 更新所有符合特定表达式的记录
        /// </summary>
        /// <param name="predicate"> 查询条件谓语表达式 </param>
        /// <param name="isSave"> 是否执行保存 </param>
        /// <returns> 操作影响的行数 </returns>
        public virtual int Update(Expression <Func <TEntity, bool> > predicate, bool isSave = true)
        {
            // 参数有效性检查
            ArgumentValidationHelper.CheckForNullReference(predicate, "传入的对象predicate为空");
            // 依据条件表达式查询实体记录
            List <TEntity> entities = EFContext.Set <TEntity>().Where(predicate).ToList();

            // 记录存在则立即执行,否则返回0
            return(entities.Count > 0 ? Update(entities, isSave) : 0);
        }
Beispiel #17
0
        /// <summary>
        /// 删除指定编号的记录
        /// </summary>
        /// <param name="id"> 实体记录编号 </param>
        /// <param name="isSave"> 是否执行保存 </param>
        /// <returns> 操作影响的行数 </returns>
        public virtual int Delete(object id, bool isSave = true)
        {
            // 参数有效性检查
            ArgumentValidationHelper.CheckForNullReference(id, "传入的对象id为空");
            // 实体记录在数据库是否存在
            TEntity entity = EFContext.Set <TEntity>().Find(id);

            // 记录存在则立即执行,否则返回0
            return(entity != null?Delete(entity, isSave) : 0);
        }
 /// <summary>
 /// Constructor to create a new single relationship definition
 /// </summary>
 /// <param name="relationshipName">A name for the relationship</param>
 /// <param name="relatedObjectAssemblyName">The assembly name of the related object</param>
 /// <param name="relatedObjectClassName">The class name of the related object</param>
 /// <param name="relKeyDef">The related key definition</param>
 /// <param name="keepReferenceToRelatedObject">Whether to keep a
 /// reference to the related object.  Could be false for memory-
 /// intensive applications.</param>
 /// <param name="orderBy">The sql order-by clause</param>
 /// <param name="deleteParentAction">Provides specific instructions
 /// with regards to deleting a parent object.  See the DeleteParentAction
 /// enumeration for more detail.</param>
 /// <param name="insertParentAction"></param>
 /// <param name="relationshipType">Provides specific instructions for adding/removing a child object.</param>
 /// <param name="timeout">The timout in milliseconds. The collection will not be automatically refreshed from the DB if the timeout has nto expired</param>
 public MultipleRelationshipDef(string relationshipName, string relatedObjectAssemblyName, string relatedObjectClassName, IRelKeyDef relKeyDef, bool keepReferenceToRelatedObject, string orderBy, DeleteParentAction deleteParentAction, InsertParentAction insertParentAction, RelationshipType relationshipType, int timeout)
     : base(relationshipName, relatedObjectAssemblyName, relatedObjectClassName, relKeyDef,
            keepReferenceToRelatedObject, deleteParentAction, insertParentAction, relationshipType)
 {
     ArgumentValidationHelper.CheckArgumentNotNull(orderBy, "orderBy");
     TimeOut             = timeout;
     OrderCriteriaString = orderBy;
     OrderCriteria       = new OrderCriteria();
     OrderCriteria       = Base.OrderCriteria.FromString(orderBy);
 }
Beispiel #19
0
 /// <summary>
 /// Adds a <see cref="IBOProp"/> to the key
 /// </summary>
 /// <param name="boProp">The BOProp to add</param>
 public virtual void Add(IBOProp boProp)
 {
     ArgumentValidationHelper.CheckArgumentNotNull(boProp, "boProp");
     if (_props.ContainsKey(boProp.PropertyName))
     {
         throw new InvalidPropertyException(String.Format(
                                                "The property with the name '{0}' that is being added already " +
                                                "exists in the key collection.", boProp.PropertyName));
     }
     _props.Add(boProp.PropertyName, boProp);
     boProp.Updated += BOPropUpdated_Handler;
 }
Beispiel #20
0
        private IMultipleRelationship GetRelationshipAsMultiple(string relationshipName)
        {
            ArgumentValidationHelper.CheckStringArgumentNotEmpty(relationshipName, "relationshipName");
            IRelationship relationship = this[relationshipName];

            if (relationship is ISingleRelationship)
            {
                throw new InvalidRelationshipAccessException("The 'single' relationship " + relationshipName +
                                                             " was accessed as a 'multiple' relationship (using GetRelatedCollection()).");
            }
            return((IMultipleRelationship)relationship);
        }
        /// <summary>
        /// Constructor to create a new Multiple Relationship Definition
        /// </summary>
        /// <param name="relationshipName">A name for the relationship</param>
        /// <param name="relatedObjectClassType">The class type of the related objects</param>
        /// <param name="relKeyDef">The related key definition</param>
        /// <param name="keepReferenceToRelatedObject">Whether to keep a
        /// reference to the related object.  Could be false for memory-
        /// intensive applications.</param>
        /// <param name="orderBy">The sql order-by clause</param>
        /// <param name="deleteParentAction">Provides specific instructions
        /// with regards to deleting a parent object.  See the DeleteParentAction
        /// enumeration for more detail.</param>
        public MultipleRelationshipDef(string relationshipName,
                                       Type relatedObjectClassType,
                                       IRelKeyDef relKeyDef,
                                       bool keepReferenceToRelatedObject,
                                       string orderBy,
                                       DeleteParentAction deleteParentAction)
            : base(relationshipName, relatedObjectClassType, relKeyDef, keepReferenceToRelatedObject, deleteParentAction)
        {
            ArgumentValidationHelper.CheckArgumentNotNull(orderBy, "orderBy");
            OrderCriteriaString = orderBy;

            this.OrderCriteria = Base.OrderCriteria.FromString(orderBy);
        }
Beispiel #22
0
        /// <summary>
        /// Sets the related business object of a <b>single</b> relationship.
        /// This includes setting the RelKey properties of the relationship owner
        /// to the value of the related object's properties.
        /// </summary>
        /// <param name="relationshipName">The name of a single relationship</param>
        /// <param name="relatedObject">The new related object</param>
        /// <exception cref="InvalidRelationshipAccessException">Thrown if
        /// the relationship named is a multiple relationship instead of a
        /// single one</exception>
        public void SetRelatedObject(string relationshipName, IBusinessObject relatedObject)
        {
            ArgumentValidationHelper.CheckStringArgumentNotEmpty(relationshipName, "relationshipName");
            IRelationship relationship = this[relationshipName];

            if (relationship is IMultipleRelationship)
            {
                throw new InvalidRelationshipAccessException("SetRelatedObject() was passed a relationship (" +
                                                             relationshipName +
                                                             ") that is of type 'multiple' when it expects a 'single' relationship");
            }
            ((ISingleRelationship)relationship).SetRelatedObject(relatedObject);
        }
Beispiel #23
0
        /// <summary>
        /// Executes a stored proc with the params given using the timeout length given.
        /// </summary>
        /// <param name="procName">The stored proc name</param>
        /// <param name="params">The parameters to pass in</param>
        /// <param name="timeout">The timeout in seconds</param>
        /// <returns>A scalar result</returns>
        public int ExecuteStoredProcNonQuery(string procName, IEnumerable <Param> @params, int timeout)
        {
            ArgumentValidationHelper.CheckArgumentNotNull(procName, "procName");
            ArgumentValidationHelper.CheckArgumentNotNull(@params, "params");
            IDbConnection con = null;

            try
            {
                con = OpenConnection;
                var cmd = CreateCommand(con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = procName;
                if (timeout > 0)
                {
                    cmd.CommandTimeout = timeout;
                }

                foreach (var param in @params)
                {
                    var dbParam = cmd.CreateParameter();
                    dbParam.DbType        = param.DbType;
                    dbParam.ParameterName = param.ParamName;
                    dbParam.Value         = param.ParamValue;
                    cmd.Parameters.Add(dbParam);
                }

                return(cmd.ExecuteNonQuery());
            }
            catch (Exception ex)
            {
                Log.Log
                    ("Error executing stored procedure : " + Environment.NewLine
                    + ExceptionUtilities.GetExceptionString(ex, 10, true), LogCategory.Exception);
                Log.Log("Stored procedure: " + procName, LogCategory.Exception);
                throw new DatabaseWriteException
                          ("There was an error writing to the database. Please contact your system administrator."
                          + Environment.NewLine + "A stored procedure command could not be completed.",
                          "A stored procedure command could not be completed: " + procName, ex, procName + String.Join(", ", @params), ErrorSafeConnectString());
            }
            finally
            {
                if (con != null && con.State != ConnectionState.Closed)
                {
                    con.Close();
                }
            }
        }
Beispiel #24
0
        /// <summary>
        /// Executes a collection of sql commands that returns no result set
        /// and takes no parameters, using the provided connection.
        /// This method can be used effectively where the database vendor
        /// supports the execution of several sql statements in one
        /// ExecuteNonQuery.  However, for database vendors like Microsoft
        /// Access and MySql, the sql statements will need to be split up
        /// and executed as separate transactions.
        /// </summary>
        /// <param name="statements">A valid sql statement object (typically "insert",
        /// "update" or "delete"). Note_ that this assumes that the
        /// sqlCommand is not a stored procedure.</param>
        /// <param name="transaction">A valid transaction object in which the
        /// sql must be executed, or null</param>
        /// <returns>Returns the number of rows affected</returns>
        /// <exception cref="DatabaseWriteException">Thrown if there is an
        /// error writing to the database.  Also outputs error messages to the log.
        /// </exception>
        /// <future>
        /// In future override this method with methods that allow you to
        /// pass in stored procedures and parameters.
        /// </future>
        public virtual int ExecuteSql(IEnumerable <ISqlStatement> statements, IDbTransaction transaction)
        {
            var inTransaction = transaction != null;

            ArgumentValidationHelper.CheckArgumentNotNull(statements, "statements");
            IDbConnection con = null;

            try
            {
                con = GetOpenConnection(transaction);
                if (transaction == null)
                {
                    transaction = BeginTransaction(con);
                }
                var totalRowsAffected = ExecuteSqlInternal(statements, con, transaction);
                if (!inTransaction)
                {
                    transaction.Commit();
                }
                return(totalRowsAffected);
            }
            catch (Exception ex)
            {
                Log.Log
                    ("Error writing to database : " + Environment.NewLine
                    + ExceptionUtilities.GetExceptionString(ex, 10, true), LogCategory.Exception);
                Log.Log("Sql: " + statements, LogCategory.Exception);
                if (transaction != null)
                {
                    transaction.Rollback();
                }
                throw new DatabaseWriteException
                          ("There was an error writing to the database. Please contact your system administrator."
                          + Environment.NewLine + "The command executeNonQuery could not be completed. :" + statements,
                          "The command executeNonQuery could not be completed.", ex, statements.ToString(), ErrorSafeConnectString());
            }
            finally
            {
                if (!inTransaction)
                {
                    if (con != null && con.State != ConnectionState.Closed)
                    {
                        con.Close();
                    }
                }
            }
        }
Beispiel #25
0
    void HaveSomeFun(bool summers)
    {
        string waterGun = < Some Value >
                          string jacket = < Some Other Value >

                                          ArgumentValidationHelper.ValidateNotNullOrEmpty("WaterGun", waterGun);

        ArgumentValidationHelper.ValidateNotNullOrEmpty("Jacket", jacket);

        if (summers)
        {
            Console.WriteLine("Using {0}", waterGun);
        }
        else
        {
            Console.WriteLine("Using {0}", jacket);
        }
    }
Beispiel #26
0
        /// <summary>
        /// 删除实体记录
        /// </summary>
        /// <param name="entity"> 实体对象 </param>
        /// <param name="isSave"> 是否执行保存 </param>
        /// <returns> 操作影响的行数 </returns>
        public virtual int Delete(TEntity entity, bool isSave = true)
        {
            // 参数有效性检查
            ArgumentValidationHelper.CheckForNullReference(entity, "传入的对象t为空");
            try
            {
                // 对象加入仓储上下文(暂不提交数据库)
                EFContext.RegisterDeleted(entity);
            }
            catch (InvalidOperationException)
            {
                Delete(entity.ID);
            }
            catch (Exception)
            {
                throw;
            }

            // 立即提交或暂缓执行
            return(isSave ? EFContext.Commit() : 0);
        }
Beispiel #27
0
        // ReSharper disable DoNotCallOverridableMethodsInConstructor
        private RelationshipDef(string relationshipName, Type relatedObjectClassType, string relatedObjectAssemblyName, string relatedObjectClassName, IRelKeyDef relKeyDef, bool keepReferenceToRelatedObject, DeleteParentAction deleteParentAction, InsertParentAction insertParentAction, RelationshipType relationshipType)
        {
            ArgumentValidationHelper.CheckArgumentNotNull(relKeyDef, "relKeyDef");
            ArgumentValidationHelper.CheckStringArgumentNotEmpty(relationshipName, "relationshipName");

            if (relatedObjectClassType != null)
            {
                MyRelatedObjectClassType = relatedObjectClassType;
            }
            else
            {
                _relatedObjectAssemblyName = relatedObjectAssemblyName;
                _relatedObjectClassName    = relatedObjectClassName;
                _relatedObjectClassType    = null;
            }
            RelKeyDef                    = relKeyDef;
            RelationshipName             = relationshipName;
            KeepReferenceToRelatedObject = keepReferenceToRelatedObject;
            this.DeleteParentAction      = deleteParentAction;
            this.InsertParentAction      = insertParentAction;
            RelationshipType             = relationshipType;
        }
Beispiel #28
0
 /// <summary>
 /// Constructor to create new RelPropDef object
 /// </summary>
 /// <param name="ownerClassPropDefName">The name of the prop on the owner object</param>
 /// <param name="relatedObjectPropName">The property name of the
 /// related object</param>
 public RelPropDef(string ownerClassPropDefName, string relatedObjectPropName)
 {
     ArgumentValidationHelper.CheckArgumentNotNull(ownerClassPropDefName, "ownerClassPropDefName");
     _ownerPropDefName    = ownerClassPropDefName;
     RelatedClassPropName = relatedObjectPropName;
 }
Beispiel #29
0
 /// <summary>
 /// Constructor to initialise a new instance
 /// </summary>
 /// <param name="lKeyDef">The key definition</param>
 internal BOKey(KeyDef lKeyDef)
 {
     ArgumentValidationHelper.CheckArgumentNotNull(lKeyDef, "lKeyDef");
     _keyDef = lKeyDef;
     _props  = new Dictionary <string, IBOProp>();
 }
Beispiel #30
0
 /// <summary>
 /// Returns true if a property with this name is part of this key
 /// </summary>
 /// <param name="propName">The property name</param>
 /// <returns>Returns true if it is contained</returns>
 public bool Contains(string propName)
 {
     ArgumentValidationHelper.CheckStringArgumentNotEmpty(propName, "propName");
     return(_props.ContainsKey(propName));
 }