private void AddEntityInsertStatement(IEntity entity, EntityInfo entityInfo, DateTime timeStamp) { var builder = new ComplexCommandBuilder(); var statement = new InsertStatement(entityInfo.Name); foreach (var element in entityInfo.Elements) { var value = element.IsTimeStamp ? timeStamp : element.GetValue(entity); var parameter = value.ToParameter(); statement.Add(element.Name, parameter.Name); builder.AddParameter(parameter); } foreach (var dataType in entityInfo.DataTypes) { foreach (var element in dataType.Elements) { var value = dataType.GetValue(element, entity); var parameter = value.ToParameter(); statement.Add(element.Name, parameter.Name); builder.AddParameter(parameter); } } builder.AddStatement(statement); Add(builder); AddSaveStatements(entity, entityInfo, timeStamp); entity.Save(timeStamp); }
private void AddEntityInsertStatement(IChild child, EntityInfo childInfo, DateTime timeStamp) { var builder = new ComplexCommandBuilder(); var statement = new InsertStatement(childInfo.Name); foreach (var element in childInfo.Elements) { var value = element.Name == "TimeStamp" ? timeStamp : element.GetValue(child); var parameter = value.ToParameter(); statement.Add(element.Name, parameter.Name); builder.AddParameter(parameter); } foreach (var dataType in childInfo.DataTypes) { foreach (var element in dataType.Elements) { var value = dataType.GetValue(element, child); var parameter = value.ToParameter(); statement.Add(element.Name, parameter.Name); builder.AddParameter(parameter); } } builder.AddStatement(statement); Add(builder); AddSaveStatements(child, childInfo, timeStamp); child.Save(timeStamp); }
private void AddValueInsertStatement(IValue value, ValueInfo valueInfo) { var builder = new ComplexCommandBuilder(); var statement = new InsertStatement(valueInfo.Name); foreach (var element in valueInfo.Elements) { var result = element.GetValue(value); var parameter = result.ToParameter(); statement.Add(element.Name, parameter.Name); builder.AddParameter(parameter); } builder.AddStatement(statement); Add(builder); value.Save(); }