public void GetProps() { // Arrange ICommandConfiguration Configuration = this.mockRepository .Of <ICommandConfiguration>() .Where(x => x.TableName == "Persona") .Where(x => x.PrimaryKeyTable == "Id") .Where(x => x.IncludeId == true) .First(); IClassConfiguration ClassConfiguration = this.mockRepository .Of <IClassConfiguration>() .Where(x => x.FieldsInclude == false) .Where(x => x.PropsInclude == true) .First(); Persona Entidad = GetPersona(); // Act var result = SqlEntityUtil.GetKeysValues( ClassConfiguration, Configuration, Entidad); // Assert Assert.IsTrue( result.Count() == 4 && result["Fecha"] == "'19820326 00:00'" && result["Nombre"] == "N'Miguel Angel'" && result["Id"] == "5" && result["Saldo"] == "null" ); }
public void GetFields() { // Arrange ICommandConfiguration Configuration = this.mockRepository .Of <ICommandConfiguration>() .Where(x => x.TableName == "Persona") .Where(x => x.PrimaryKeyTable == "Id") .Where(x => x.IncludeId == true) .First(); IClassConfiguration ClassConfiguration = this.mockRepository .Of <IClassConfiguration>() .Where(x => x.FieldsInclude == true) .Where(x => x.PropsInclude == false) .First(); Persona Entidad = GetPersona(); // Act var result = SqlEntityUtil.GetKeysValues( ClassConfiguration, Configuration, Entidad); // Assert Assert.IsTrue(result.Count() == 1 && result["edad"] == "37"); }
public string Select() { var SqlConsultant = SqlConsultantHelper.CreateQuerier(Type, this.Configuration); return(SqlConsultant.Select( SqlEntityUtil.GetKeys <T>(this.Configuration), this.sExpression, this.Order)); }
public string Insert(T entity) { var SqlConsultant = SqlConsultantHelper.CreateCommander(Type, this.Configuration); var value_keys = SqlEntityUtil.GetKeysValues(this.Configuration, entity); return(SqlConsultant.Insert( value_keys.Keys, value_keys.Values)); }
public string Update(T entity) { var SqlConsultant = SqlConsultantHelper.CreateCommander(Type, this.Configuration); var value_keys = SqlEntityUtil.GetKeysValues(this.Configuration, entity); return(SqlConsultant.Update( value_keys, this.sExpression )); }
public string Insert(T[] entities) { var SqlConsultant = SqlConsultantHelper.CreateCommander(Type, this.Configuration); var values = entities.Select(x => SqlEntityUtil.GetValues(this.Configuration, x)); var keys = SqlEntityUtil.GetKeys <T>(this.Configuration, this.Configuration); return(SqlConsultant.Insert( keys, values)); }