Ejemplo n.º 1
0
        private void Fill(EntityBundle item)
        {
            NpgsqlCommand cmd = Db.GetCmd(Db.ConnectionString);

            cmd.CommandText = Db.SelectElement;
            cmd.Parameters.AddWithValue("id", item.Id);
            NpgsqlDataReader rdr = Db.ExecuteReader(cmd);
            BundleElement    o   = null;

            if (rdr != null)
            {
                try
                {
                    while (rdr.Read())
                    {
                        o = EntityBundleElementBuilder.Instance.Build(rdr);
                        if (o != null)
                        {
                            item.elements.Add(o.EntityId, o);
                        }
                    }

                    if (cmd.Connection.State == System.Data.ConnectionState.Open)
                    {
                        cmd.Connection.Close();
                    }
                }
                catch
                { }
                finally
                {
                    cmd.Dispose();
                }
            }
        }
Ejemplo n.º 2
0
 public BundleElement Add(CompoundIdentity entityId, string localKey, string displayName)
 {
     if (entityId != null && BundleElement.MatchesType(entityId, this.DataType) && !string.IsNullOrEmpty(displayName))
     {
         if (!(this.Contains(entityId) || this.Contains(localKey)))
         {
             this.elementsDirty = true;
             BundleElement tmp = new BundleElement(this.Id, entityId, localKey, displayName);
             this.elements.Add(entityId, tmp);
             return(tmp);
         }
     }
     return(null);
 }