예제 #1
0
        private void AppendInsertCommand(List <DbParameter> commandParameters, StringBuilder commandTextBuilder, IEntity entity, IPersistenceStorageObjectMapper mapper)
        {
            var parameters = mapper.GetParameters(entity);

            InitializeAndAppendParameters(commandParameters, parameters);
            AppendInsertCommandTextForType(parameters, mapper.GetTableName(), commandTextBuilder);
        }
예제 #2
0
        private void AppendUpdateCommand(List <DbParameter> commandParameters, StringBuilder commandTextBuilder, IEntity entity, IPersistenceStorageObjectMapper mapper)
        {
            var parameters = mapper.GetParameters(entity);

            InitializeAndAppendParameters(commandParameters, parameters);
            if (parameters.Length > 1)             // If entity has other properties besides ID.
            {
                AppendUpdateCommandTextForType(parameters, mapper.GetTableName(), commandTextBuilder);
            }
            else
            {
                AppendEmptyUpdateCommandTextForType(parameters, mapper.GetTableName(), commandTextBuilder);
            }
        }