Esempio n. 1
0
        public static Tuple <Table <EntityWithArrayType>, List <EntityWithArrayType> > GetDefaultTable(
            ISession session, string tableName)
        {
            // create table
            var config = new MappingConfiguration().Define(
                new Map <EntityWithArrayType>()
                .TableName(tableName)
                .PartitionKey(u => u.Id));
            var table      = new Table <EntityWithArrayType>(session, config);
            var entityList = EntityWithArrayType.GetDefaultEntityList();

            return(new Tuple <Table <EntityWithArrayType>, List <EntityWithArrayType> >(table, entityList));
        }
Esempio n. 2
0
        public static Tuple <Table <EntityWithArrayType>, List <EntityWithArrayType> > SetupDefaultTable(ISession session)
        {
            // create table
            var config = new MappingConfiguration().Define(
                new Map <EntityWithArrayType>()
                .TableName("EntityWithArrayType_" + Randomm.RandomAlphaNum(12))
                .PartitionKey(u => u.Id));
            var table = new Table <EntityWithArrayType>(session, config);

            table.Create();

            var entityList = EntityWithArrayType.GetDefaultEntityList();

            //Insert some data
            foreach (var singleEntity in entityList)
            {
                table.Insert(singleEntity).Execute();
            }

            return(new Tuple <Table <EntityWithArrayType>, List <EntityWithArrayType> >(table, entityList));
        }