Exemplo n.º 1
0
        /// <summary>
        /// Adapts a LWT RowSet and returns a new AppliedInfo
        /// </summary>
        internal static AppliedInfo <T> FromRowSet(MapperFactory mapperFactory, string cql, RowSet rs)
        {
            var          row           = rs.FirstOrDefault();
            const string appliedColumn = "[applied]";

            if (row == null || row.GetColumn(appliedColumn) == null || row.GetValue <bool>(appliedColumn))
            {
                //The change was applied correctly
                return(new AppliedInfo <T>(true));
            }
            if (rs.Columns.Length == 1)
            {
                //There isn't more information on why it was not applied
                return(new AppliedInfo <T>(false));
            }
            //It was not applied, map the information returned
            var mapper = mapperFactory.GetMapper <T>(cql, rs);

            return(new AppliedInfo <T>(mapper(row)));
        }
 /// <summary>
 /// Clears all the mapping defined for this instance
 /// </summary>
 internal void Clear()
 {
     _typeDefinitions = new LookupKeyedCollection <Type, ITypeDefinition>(td => td.PocoType);
     MapperFactory    = new MapperFactory(_typeConverter, new PocoDataFactory(_typeDefinitions));
     StatementFactory = new StatementFactory();
 }
Exemplo n.º 3
0
 public CqlBatch(MapperFactory mapperFactory, CqlGenerator cqlGenerator)
     : this(mapperFactory, cqlGenerator, BatchType.Logged)
 {
 }
Exemplo n.º 4
0
 /// <summary>
 /// Configures CqlPoco to use the specified type conversion factory when getting type conversion functions for converting
 /// between data types in the database and your POCO objects.
 /// </summary>
 public MappingConfiguration ConvertTypesUsing(TypeConverter typeConverter)
 {
     _typeConverter = typeConverter ?? throw new ArgumentNullException("typeConverter");
     MapperFactory  = new MapperFactory(_typeConverter, new PocoDataFactory(_typeDefinitions));
     return(this);
 }