MVC Browser history provider for azure–trying an implementation for 3 hours
first, implement IBrowserUserHistoryRepository – that means implement:
public void Save(IEnumerable<BrowserUserHistoryData> history)
Azure have PartitionKey/RowKey – I have to add a new class.
Also or connectiing, I have to put
connectionString="UseDevelopmentStorage=true;" /
I tried to add a bulk history :
tableHistory.ExecuteBatch(batchOperation);
The result was:
Unexpected response code for operation : 0
Magic:
<add key="TableStorageEndpoint" value="http://127.0.0.1:1002/"/>
And one hour has been gone.
Run dsinit to have storage emulator:
No connection could be made because the target machine actively refused it 127.0.0.1:10002
modified code to old Azure code:
now the answer was:
One of the request inputs is out of range.
http://msdn.microsoft.com/en-us/library/dd135715.aspx – All letters in a container name must be lowercase.
Tried that – same result:
One of the request inputs is out of range.
Maybe timestam is wrong? No…
Now debug with Fiddler :
http://sepialabs.com/blog/2012/02/17/profiling-azure-storage-with-fiddler/
Added to connection string:
DevelopmentStorageProxyUri=http://ipv4.fiddler
And see this in Fiddler :
<d:PartitionKey>zungb4ovunqjd5rtal5ytc3r</d:PartitionKey>
<d:RowKey>http://localhost:2728/</d:RowKey>
: base(UserName, UserName)
So the problem is that RowKey does not support url values.
Now , after removing url from the RowKey - and put username, the error was:
The specified entity already exists
Another hour passes
——————
Now, that it works, thinking about rowkey and partitionkey : no username + url => put date.ToString("yyyyMMdd_HHmmss_tttt")
0:The specified entity already exists.
Oh no, not again?
Look tables =>20121220_064024_AM - ok, it should be
date.ToString("yyyyMMdd_HHmmss_ffffzzz")
0:The specified entity already exists
Again? debug, please
The real problem:
Forget about sending whole items history - not just not saved ones…
Now it works – kind of
Server Error in ‘/’ Application.
The method or operation is not implemented.
public IEnumerable<KeyValuePair<string, int>> MostUsed(int Count, DateTime? date) Line 80: { Line 81: throw new NotImplementedException(); Line 82: } Line 83:
-----------
Implementing MostUsed(int Count, DateTime? date)
Research about filter with data - http://storageextensions.codeplex.com/SourceControl/changeset/view/81826#1914483
Research about GroupBY – not supported!http://msdn.microsoft.com/en-us/library/windowsazure/dd135725.aspx
So now thinking about a way to STORE the data in a convenient format to can retrieve…
It must take into consideration Count for a date and Count for all dates( date can be null) – AND BOTH THE FACT THAT THE OPERATION WILL BE DONE PER USER.
Time to think – because another hour has passed!
Leave a Reply