dtretyakov / WindowsAzure

.NET library aimed at managing and querying entities from Windows Azure Storage. It can be used as LINQ to Azure Tables.
MIT License
64 stars 27 forks source link

TableSet.Add(entities) doesn't work properly. #29

Closed hakotaro closed 10 years ago

hakotaro commented 10 years ago

Hi

TableSet.Add(entities) doesn't seems to work properly, even through TableSet.AddAsync(entities) work well.

Example Code I test is below

string connectionString = "UseDevelopmentStorage=true"; // change to your connectionString string tableName = "testTableName"; CloudStorageAccount account = CloudStorageAccount.Parse(connectionString); CloudTableClient tableClient = account.CreateCloudTableClient(); tableClient.GetTableReference(tableName).CreateIfNotExists(); TableSet tset = new TableSet(tableClient,tableName);

tset.AddAsync(deList); // work tset.Add(deList); //doesn't work

If there are some mistakes I made, please let me know.

dtretyakov commented 10 years ago

Hello, thanks for posting it'll be fixed in the next version.

dtretyakov commented 10 years ago

Please note that TableSet.Add() method returns IEnumerable which is a deferred result. So to execute insert operation you should enumerate result items like that:

tset.AddAsync(deList); // work, because it's not a deferred
tset.Add(deList).ToList(); // should work

If you have other questions feel free to communicate.