fengshao0907 / servicestack Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/servicestack
Automatically exported from code.google.com/p/servicestack
Hi,
here is the code:
Console.WriteLine("test7 start");
var rc = new RedisClient();
var u = ServiceLayerContext.ServiceUsers.GetByID(6);
Console.WriteLine("Show what we have in DTO");
Console.WriteLine(u.ToValueObject().Dump());
Console.WriteLine("Save in Redis");
rc.Add("test2", u.ToValueObject(), TimeSpan.FromSeconds(20));
Console.WriteLine("Getting from Redis");
var t = rc.GetById<Engine.BLL.DTO.User>("test2");
Console.WriteLine("Dumping to show nothing extracted");
Console.WriteLine(t.Dump());
that's what I get:
Show what we have in DTO
{
UserID: 3,
FirstName: John,
LastName: Smith,
Email: [email protected],
Password: test,
ID: 0,
Created: 0001-01-01,
TypeID: User
}
Save in Redis
Getting from Redis
Dumping to show nothing extracted
Question:
what I'm doing wrong?
Redis said one key added: http://screencast.com/t/ZmJlZTAz
if I change the code to use typed provider:
public void test8()
{
Console.WriteLine("test7 start");
var rc = new RedisClient("localhost", 6379).GetTypedClient<Engine.BLL.DTO.User>();
var u = ServiceLayerContext.ServiceUsers.GetByID(6);
Console.WriteLine("Show what we have in DTO");
Console.WriteLine(u.ToValueObject().Dump());
Console.WriteLine("Save in Redis");
rc.Store(u.ToValueObject());
Console.WriteLine("Getting from Redis");
var t = rc.GetAll();
Console.WriteLine("Dumping to show nothing extracted");
Console.WriteLine(t.Dump());
}
it's getting better: http://screencast.com/t/NmVhNjQ4N
but the problem is that if I change IDs in the call here:
var u = ServiceLayerContext.ServiceUsers.GetByID(7); and then
var u = ServiceLayerContext.ServiceUsers.GetByID(8);
those IDs present in DB and returned by this class. I still get only one record
in DUMP.
http://screencast.com/t/ODMzMGI0YzE
so it rewrites the old one immediately. The only way I can store several
records if I do this
public void test8()
{
Console.WriteLine("test7 start");
var rc = new RedisClient("localhost", 6379).GetTypedClient<Engine.BLL.DTO.User>();
var u = ServiceLayerContext.ServiceUsers.GetByID(6);
rc.Store(u.ToValueObject());
u = ServiceLayerContext.ServiceUsers.GetByID(7);
rc.Store(u.ToValueObject());
u = ServiceLayerContext.ServiceUsers.GetByID(8);
rc.Store(u.ToValueObject());
Console.WriteLine("Getting from Redis");
var t = rc.GetAll();
Console.WriteLine("Dumping to show nothing extracted");
Console.WriteLine(t.Dump());
}
so then in one run I'll get records in redis. Please let me know the solution
Original issue reported on code.google.com by [email protected]
on 7 Jul 2010 at 3:10
What steps will reproduce the problem?
1. Added custom authenicator in web.config
2. Added a breakpoint on my service and authenticator and called service.
3. Debuggers stops at execute and never runs Authenticate.
What is the expected output? What do you see instead?
I was hoping to use out of the box Custom authenticator example as per the
visual studio 2010 WCF Rest Service with API key example project (available
from the online templates section in file -> new project)
What version of the product are you using? On what operating system?
latest servicestack on windows 7 vs 2010
Please provide any additional information below.
Am I missing something. Does service stack have existing extension behaviour
for authorisation that I am missed?
Original issue reported on code.google.com by LepardUK
on 11 Oct 2010 at 2:51
Here are some basic steps to reproduce the issue
1. Create a service on a Windows Machine (Mine was Windows Server 2008)
2. Create an iphone client in MonoTouch which consumes the service at it's JSON
endpoint (using
ServiceStack.Client.dll)
The expected output is a correct deserialization of the object. What I get
instead is:
Unhandled Exception: System.Runtime.Serialization.SerializationException:
JsonDataContractDeserializer: Error converting to type: Deserialization has
failed --->
System.Runtime.Serialization.SerializationException: Deserialization has failed
--->
System.Xml.XmlException: Comma is required unless an array or object is at the
end (1,52)
at System.Runtime.Serialization.Json.JsonReader.ReadContent (Boolean objectValue) [0x00000]
in <filename unknown>:0
at System.Runtime.Serialization.Json.JsonReader.Read () [0x00000] in <filename unknown>:0
at System.Xml.XmlReader.Skip () [0x00000] in <filename unknown>:0
at System.Runtime.Serialization.Json.TypeMap.Deserialize
(System.Runtime.Serialization.Json.JsonSerializationReader jsr) [0x00000] in
<filename
unknown>:0
at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type)
[0x00000] in <filename unknown>:0
at System.Runtime.Serialization.Json.JsonSerializationReader.ReadRoot () [0x00000] in
<filename unknown>:0
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject
(System.Xml.XmlReader reader, Boolean verifyObjectName) [0x00000] in <filename
unknown>:0
--- End of inner exception stack trace ---
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject
(System.Xml.XmlReader reader, Boolean verifyObjectName) [0x00000] in <filename
unknown>:0
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject
(System.Xml.XmlDictionaryReader reader, Boolean verifyObjectName) [0x00000] in
<filename
unknown>:0
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject
(System.Xml.XmlDictionaryReader reader) [0x00000] in <filename unknown>:0
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject (System.IO.Stream
stream) [0x00000] in <filename unknown>:0
at ServiceStack.Client.JsonDataContractDeserializer.Parse (System.String json, System.Type
returnType) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at ServiceStack.Client.JsonDataContractDeserializer.Parse (System.String json, System.Type
returnType) [0x00000] in <filename unknown>:0
at ServiceStack.Client.JsonServiceClient.Send[GetPropertyByGuidResponse] (System.Object
request) [0x00000] in <filename unknown>:0
at iNorc.PropertyDetailsView.ViewDidLoad () [0x00000] in <filename unknown>:0
at (wrapper managed-to-native)
MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend_IntPtr_Boolean
(intptr,intptr,intptr,bool)
at MonoTouch.UIKit.UINavigationController.PushViewController
(MonoTouch.UIKit.UIViewController viewController, Boolean animated) [0x00000]
in <filename
unknown>:0
at iNorc.PropertyCalloutBubbleDelegate.RowSelected (MonoTouch.UIKit.UITableView tableView,
MonoTouch.Foundation.NSIndexPath indexPath) [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain
(int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName,
System.String delegateClassName) [0x00000] in <filename unknown>:0
at MonoTouch.UIKit.UIApplication.Main (System.String[] args) [0x00000] in <filename
unknown>:0
at iNorc.Application.Main (System.String[] args) [0x00000] in <filename unknown>:0
I am using the ServiceStack v1.10 library on a Windows 2008 Machine and the
ServiceStack client
library provided with the example RemoteInfo.zip, on an iPhone Simulator
platform.
The issue might very well be with the Mono framework itself. However, i was
able to get the
deserialization code working after changing line 19 from
JsonDataContractSerializer.cs from the
ServiceStack.Client assembly from:
var bytes = Encoding.Unicode.GetBytes(json);
to
var bytes = Encoding.UTF8.GetBytes(json);
While analyzing the serialization code from
ServiceStack.ServiceModel.Serialization.JsonDataContractSerializer, i saw that
the stream reader
used to serialize the object has no explicit encoding, therefore using the
default UTF8 ecoding.
On the other hand, the deserialization is made by converting the json string to
a byte array using
Unicode encoding (which is UTF-16).
So, while i see no issues with the server deserializing it properly (as it also
uses Unicode to
deserialize an object serialized as an UTF-8 encoded string from the MonoTouch
application),
the response cannot be properly deserialized back.
My suggestion is to either use explicit encodings on both ends or to employ
some kind of
encoding detection mechanism (see
http://www.west-wind.com/WebLog/posts/197245.aspx
for an example).
Original issue reported on code.google.com by [email protected]
on 5 Apr 2010 at 12:33
What steps will reproduce the problem?
1. theRedisClient = new RedisClient(dbHostAddress);
2. Upon GC of the RedisClient a "Safe Handle Has Been Closed" exception is
triggered.
What version of the product are you using? On what operating system?
.NET 3.5 and latest release of ServiceStack.dll
Please provide any additional information below.
Call Stack Included:
System.dll!System.Net.Sockets.Socket.UnsetAsyncEventSelect() + 0x53 bytes
System.dll!System.Net.Sockets.Socket.SetToDisconnected() + 0x1e bytes
System.dll!System.Net.Sockets.Socket.UpdateStatusAfterSocketError(System.Ne
t.Sockets.SocketError errorCode) + 0x4e bytes
System.dll!System.Net.Sockets.Socket.Send(byte[] buffer, int offset, int
size, System.Net.Sockets.SocketFlags socketFlags, out
System.Net.Sockets.SocketError errorCode = NotSocket) + 0x226 bytes
System.dll!System.Net.Sockets.Socket.Send(byte[] buffer, int offset, int
size, System.Net.Sockets.SocketFlags socketFlags) + 0x20 bytes
System.dll!System.Net.Sockets.Socket.Send(byte[] buffer) + 0x18 bytes
ServiceStack.dll!ServiceStack.Redis.RedisNativeClient.SendCommand(byte[][]
cmdWithBinaryArgs = {byte[1][]}) + 0x91 bytes
ServiceStack.dll!ServiceStack.Redis.RedisNativeClient.Quit() + 0x55 bytes
ServiceStack.dll!ServiceStack.Redis.RedisNativeClient.DisposeConnection() +
0x48 bytes
ServiceStack.dll!ServiceStack.Redis.RedisNativeClient.Dispose(bool
disposing = false) + 0x53 bytes
ServiceStack.dll!ServiceStack.Redis.RedisNativeClient.Finalize() + 0x3a
bytes
Original issue reported on code.google.com by [email protected]
on 7 May 2010 at 11:06
I'm trying to implement transparent caching in my service client. In order to
accomplish this, I've now duplicated the ServiceClientBase code, but I guess
some extra extensibility could facilitate this better.
Only making ServiceClientBase.Send<TResponse>(object request) virtual would
already suffice. In the overridden version, one could create a unique cache key
for the request, and do the following:
public override TResponse Send<TResponse>(object request)
{
var cacheKey = request.GetCacheKey();
if (cache.Exists(cacheKey))
return cache[cacheKey];
var result = base.Send(request);
cache[cacheKey] = result;
}
Btw, I'm using ICacheClient and it's such a breeze to switch between Redis, Xml
files or even just memory in the blink of an eye :)
Original issue reported on code.google.com by [email protected]
on 25 Aug 2010 at 8:03
I made some changes to the code to be able to build with Silverlight (see files
attached). I haven't tested it yet. I haven't been able to find how to convert
from UTF-32 to UTF-16 and there are also these 2 points I'm not sure about:
return value => char.Parse(value);
(is equivalent to)?
char cValue;
return (value) => char.TryParse(value, out cValue)? cValue : '\0';
var unicodeCharArray = json.ToCharArray(index, 4);
(is equivalent to)?
var unicodeCharArray = json.Substring(index, 4).ToCharArray();
Thank you,
Eric.
Original issue reported on code.google.com by [email protected]
on 18 Aug 2010 at 8:11
Attachments:
Hi Demis,
I'm starting to use the transaction support on RedisClient. I find when using
the CreateTransaction function as the first call on the redis client
(triggering connection) it fails with a 'no queued operation is currently set'.
This seems to be because straight after connect the client makes a call to get
the version. This call happens after a transaction has been attached to the
client but before the MULTI command has been sent.
I currently make a call to DbSize to force connection before any transaction
calls but a transaction will still fail if it needs to reconnect.
Keep up the awesome work!
Thanks
Pete
Stack trace below.
System.InvalidOperationException : No queued operation is currently set
at ServiceStack.Redis.RedisTransaction.AssertCurrentOperation()
at ServiceStack.Redis.RedisTransaction.CompleteBytesQueuedCommand(Func`1
bytesReadCommand)
at ServiceStack.Redis.RedisNativeClient.SendExpectData(Byte[][]
cmdWithBinaryArgs)
at ServiceStack.Redis.RedisNativeClient.get_Info()
at ServiceStack.Redis.RedisNativeClient.get_IsPreVersion1_26()
at ServiceStack.Redis.RedisNativeClient.Connect()
at ServiceStack.Redis.RedisNativeClient.AssertConnectedSocket()
at ServiceStack.Redis.RedisNativeClient.SendCommand(Byte[][] cmdWithBinaryArgs)
at ServiceStack.Redis.RedisNativeClient.Multi()
at ServiceStack.Redis.RedisClient.CreateTransaction()
Original issue reported on code.google.com by townsend.pete
on 22 Jul 2010 at 10:55
What steps will reproduce the problem?
1. Open ServiceStack Examples in MonoDevelop (2.4) in WinXP.
2. Rename Web.config.rename_for_iis6_mono to Web.config
3. http://localhost:8080/Public/Xml/SyncReply/GetFactorial?ForNumber=5
What is the expected output? What do you see instead?
Expect: to see factorial of 5
Instead I see the following:
<GetFactorialResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.sericestack.net/examples/types">
<ResponseStatus>
<ErrorCode>PlatformNotSupportedException</ErrorCode>
<ErrorMessage>This operation requires IIS integrated pipeline
mode.</ErrorMessage>
<StackTrace> at System.Web.HttpResponse.get_Headers()
at ServiceStack.WebHost.Endpoints.Extensions.HttpResponseWrapper.get_Headers()
at ServiceStack.WebHost.Endpoints.Extensions.HttpResponseExtensions.WriteToResponse(IHttpResponse response, Object result, Func`2 defaultAction, String defaultContentType)</StackTrace>
</ResponseStatus>
</GetFactorialResponse>
What version of the product are you using? On what operating system?
Using Version 1.34 of Service Stack released on 20/06/2010 on WinXP & Mono.
Please provide any additional information below.
It was working fine with the earlier version.
Original issue reported on code.google.com by [email protected]
on 22 Jun 2010 at 6:21
I have not found any forum to ask, so I'll ask here.
We have site with highload usage (300K+ visitors day).
We want to use redis to store statistics data.
Now I have problem with multi simultaneous request.
First I've used one static field
private static RedisClient _RedisClient = new RedisClient()
but this gives us error "Unknown reply on integer response: 547, sPort: 3112,
LastCommand:"
Then I change it to field
private RedisClient _RedisClient = _BasicRedisClientManager.GetClient();
But this give us that server runs out of socket connection and it shut down.
Then I change it to using constuction, when i need redisconnection
using (var RedisClient = _BasicRedisClientManager.GetClient())
{}
server is running, but I started to receive error
"Only one usage of each socket address (protocol/network address/port) is
normally permitted 127.0.0.1:6379"
Can you tell how to use RedisClient in right way, when there are many
simultaneous connections.
Original issue reported on code.google.com by okhotny
on 26 Jul 2010 at 7:49
What steps will reproduce the problem?
1. Set the DB context
2. Make a request to Redis (I'm using push )
3. Keep doing it
4. DB X, in my experience will get 0-1 of the pushes, DB 0 will then start
getting everything.
What is the expected output? What do you see instead?
Database should only need to be set once. Database needs to be set everytime
you make a request to ensure reliability
What version of the product are you using? On what operating system?
The version from Friday, June 18, 2010, Windows 7. Although I don't have the
exact version, I am told by my coworker (who has worked with you on an issue
during that release) that it is "1.3.7ish"
Please provide any additional information below.
What i'm doing is, using a server to receive some data from a client, put it
into DB1 of a Redis instance, and then retrieve it via a secondary process
after the fact. I'm creating my Redis instance via a Wrapper that acts only to
expose the push/pop methods (a simple queue). It gets created once and is
persisted for as long as the process remains alive, so the object sits in
memory more than just a few seconds.
The issue I'm running into is that the DB property on the RedisNativeClient
only sets the DB once, but the connection appears to be recycled at some point
(it doesn't appear as though it happens every time, but it does seem to
happen). What I'll end up with is 0-1 entries in my chosen DB (1, in this
case), and the rest in DB0.
The solution i have is to just re-set the DB property before every use of the
class inside of my wrapper, but I figure you might want to look into persisting
the selected DB on each connection being opened.
Original issue reported on code.google.com by [email protected]
on 30 Jun 2010 at 10:09
Please refer the code here: http://pastie.org/986760.
The first loop is calling Redis.Set()...passing string object for value.
In my env its taking 100 msec for each Redis.Set() in the loop.
The second loop is calling list.Add()...and it takes 50 msec for each Add().
Why does a Set() call take twice as much time as Add()? The "monitor" command
shows that each "Set()" call results in "SADD" and "SET" commands...is this
expected?
I'm using latest version of C# client and Redis Server 1.2.6 running on
Linux.
Original issue reported on code.google.com by [email protected]
on 1 Jun 2010 at 3:24
What steps will reproduce the problem?
1. Running the getXML function results in failure on SerializeToString line
What is the expected output? What do you see instead?
Expecting serialize (json) string in result variable.
Exception raised due to XmlReader type:
A first chance exception of type 'System.TypeInitializationException' occurred
in ServiceStack.Text.dll
What version of the product are you using? On what operating system?
ServiceStack.Text.dll 1.37, XP Pro SP3, .NET 3.5
Please provide any additional information below.
I expect the exception is raised due to an unsuitable type (i.e. XmlReader).
Would appreciate example of getting the standard XmlReader (or derivative) into
this library call.
Original issue reported on code.google.com by [email protected]
on 22 Jul 2010 at 3:55
Attachments:
I'm interested in your JSON serializer but I'm unable to compile it because the
ServiceStack/Common folder (and its files) are missing from the trunk.
Thank you,
Eric Desgranges.
Original issue reported on code.google.com by [email protected]
on 18 Aug 2010 at 1:11
What steps will reproduce the problem?
1. service stack examples project
2. make any soap call
3. all xml and rest calls still seem to work
What is the expected output? What do you see instead?
The message with To 'http://<hostname>/Public/Soap11/SyncReply.svc/<service>'
cannot be processed at the receiver, due to an AddressFilter mismatch at the
EndpointDispatcher. Check that the sender and receiver's EndpointAddresses
agree
What version of the product are you using? On what operating system?
latest on windows 7. some chatter on the web suggests a .net framework patch
may be to blame?
Please provide any additional information below.
Original issue reported on code.google.com by LepardUK
on 20 Oct 2010 at 7:52
I'm curious where the default data directory is when using the Redis Server
bits available on the download page.
I'm also wondering how the bits were compiled, and whether there's a 64 bit
version on the map.
Thanks,
Mike
Original issue reported on code.google.com by [email protected]
on 30 Oct 2010 at 5:22
What steps will reproduce the problem?
1. create a SQL-Server 2008 table with a "bit" column
2. in your object map this column to "bool"
3. read a record from the table
You get an error for the call of System.Number.ParseInt32(...).
The error occurs in method:
"public override object ConvertDbValue(object value, Type type)"
This line produces the error:
"var intVal = int.Parse(value.ToString());"
value is bool, which means value.ToString() results either as the string "true"
or "false". When trying to int.Parse a string like "true" or "false" the result
is a parse error. It would be better to use Convert.ToInt32(...) instead.
Original issue reported on code.google.com by [email protected]
on 31 Aug 2010 at 11:02
What steps will reproduce the problem?
public IDictionary<string, int> HarvestRedis(IRedisClient redis, DateTime date)
{
var keys = redis.SearchKeys("foo*");
if (keys.Count > 0)
{
var dict = new Dictionary<string, int>();
using(var transaction = redis.CreateTransaction())
{
foreach(var key in keys)
{
var y = key;
transaction.QueueCommand(x => x.Get<int>(y));
}
transaction.Commit();
}
return dict;
}
return new Dictionary<string, int>();
}
What is the expected output? What do you see instead?
expect dict to contain the values from redis, it comes back empty.
What version of the product are you using? On what operating system?
servicestack.redis 1.3.1
Please provide any additional information below.
we're using redis 2.0rc1 as well.
Original issue reported on code.google.com by [email protected]
on 17 Jun 2010 at 6:41
Hi,
What will happen if let's say Redit consumed 100% of allowed memory and I'm
trying to call Store method to add new element into Redis?
How does it handle such situations?
Thanks,
Dmitry
Original issue reported on code.google.com by [email protected]
on 20 Jul 2010 at 11:43
hi, seems to be impossibile to deserialize json when typed dictionary is used.
public class Item {
public int type {get;set;}
public int color {get;set;}
}
public class Basket {
public Basket() {
Items=new Dictionary<Program.Item, int>();
}
public Dictionary<Item, int> Items {get;set;}
}
public static void Main() {
Basket b = new Basket();
b.Items.Add(new Item(){type=1,color=2},10);
b.Items.Add(new Item(){type=4,color=1},20);
string str = TypeSerializer.SerializeToString<Basket>(b);
Console.WriteLine(str);
Basket b2 = TypeSerializer.DeserializeFromString<Basket>(str);
Console.WriteLine(b2.SerializeToString());
}
thanks a lot !
Original issue reported on code.google.com by [email protected]
on 4 Oct 2010 at 8:53
When doing the following:
new ServiceStack.Configuration.ConfigurationResourceManager().Get("Foo", "Bar")
One would expect the result to be "Bar" if the setting is not present, but it
becomes null.
I've downloaded the latest ServiceStack, and the reflected code looks like this:
public T Get<T>(string name, T defaultValue)
{
return TypeSerializer.DeserializeFromString<T>(ConfigUtils.GetNullableAppSetting(name));
}
defaultValue is never used.
Original issue reported on code.google.com by [email protected]
on 24 Aug 2010 at 8:51
Same client connect on 2 redis servers based on windows distribution. One on
win7 x86, second on win 2008 r2 x64.
When i do redis.ExpireEntryAt(dbKey,DateTime.Now.AddHour(1));
The key is availaible on the first, and expires immediatly on second.
When i look at redis monitor, seems the generated unixtime was now - 1h
A convert issue ?
ExpireAt works fine
Original issue reported on code.google.com by [email protected]
on 31 Aug 2010 at 3:44
Hi,
It is possible to use Redis as an embedded DB instead of having to install it
as a server on the target machine?
Original issue reported on code.google.com by [email protected]
on 29 Jul 2010 at 9:26
What steps will reproduce the problem?
1. start empty redis
2. call GetKeys()
3. return value is string array of length 1 containing an empty string
Original issue reported on code.google.com by [email protected]
on 17 Mar 2010 at 9:05
What steps will reproduce the problem?
Invoke RedisTypedClient.GetHashValues
The command being sent is HValues.
As per the Redis api documentation, it ought to be HVals
http://code.google.com/p/redis/wiki/HgetallCommand
What is the expected output? What do you see instead?
Expected output is list of child objects in hash. What I see is an
exception
What version of the product are you using? On what operating system?
http://servicestack.googlecode.com/files/redis-1.3.9-windows.zip
on Windows 7
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 29 Apr 2010 at 2:55
Some redis commands don't seem to be supported by the current RedisClient
implementation (e.g. CONFIG). It would be great if all the SendCommand methods
would be public, so that anybody is able to send new/unsupported commands.
Especially for the CONFIG command it would be nice to have an accessor like
this:
client.Configuration["save"] = "900 1 300 10 60 1000";
Or even typed access like this:
client.Configuration.Save = new []
{
new SaveConfigurationSetting(900, 1),
new SaveConfigurationSetting(300, 10),
new SaveConfigurationSetting(60, 1000),
};
Original issue reported on code.google.com by [email protected]
on 21 Nov 2010 at 12:44
Using the latest TypeSerializer in my own application a got an exception during
serialization.
Following test object:
[Serializable]
public abstract class CorrelativeDataBase
{
protected CorrelativeDataBase()
{
CorrelationIdentifier = GetNextId();
}
public Guid CorrelationIdentifier { get; set; }
protected static Guid GetNextId()
{
return Guid.NewGuid();
}
}
[Serializable]
public sealed class TestObject : CorrelativeDataBase
{
public Type SomeType { get; set; }
public string SomeString { get; set; }
public IEnumerable<Type> SomeTypeList { get; set; }
public IEnumerable<Type> SomeTypeList2 { get; set; }
public IEnumerable<object> SomeObjectList { get; set; }
}
Due a interface limitation i dont know the type of the object to serialize, so
my test call was:
var obj = new TestObject()
{
SomeType = typeof(string),
SomeString = "Test",
SomeObjectList = new object[0];
}
var result = TypeSerializer.SerializeToString<object>(obj);
Following Exception was the result:
System.TypeInitializationException was unhandled
Message="The type initializer for 'ServiceStack.Text.Jsv.JsvWriter`1' threw an exception."
Source="ServiceStack.Text"
TypeName="ServiceStack.Text.Jsv.JsvWriter`1"
StackTrace:
at ServiceStack.Text.Jsv.JsvWriter`1.WriteFn()
at ServiceStack.Text.Jsv.JsvWriter.GetWriteFn(Type type) in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\JsvWriter.Generic.cs:line 39
at ServiceStack.Text.Jsv.JsvWriter.WriteLateBoundObject(TextWriter writer, Object value) in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\JsvWriter.Generic.cs:line 49
at ServiceStack.Text.Jsv.JsvWriter`1.WriteObject(TextWriter writer, Object value) in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\JsvWriter.Generic.cs:line 224
at ServiceStack.Text.TypeSerializer.SerializeToString[T](T value) in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\TypeSerializer.cs:line 100
at Serialization.ServiceStackTypeSerializer.Serialize(Object obj)
at .....
InnerException: System.TypeInitializationException
Message="The type initializer for 'ServiceStack.Text.Jsv.WriteType`1' threw an exception."
Source="ServiceStack.Text"
TypeName="ServiceStack.Text.Jsv.WriteType`1"
StackTrace:
at ServiceStack.Text.Jsv.WriteType`1.get_Write() in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\WriteType.cs:line 32
at ServiceStack.Text.Jsv.JsvWriter`1.GetWriteFn() in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\JsvWriter.Generic.cs:line 205
at ServiceStack.Text.Jsv.JsvWriter`1..cctor() in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\JsvWriter.Generic.cs:line 106
InnerException: System.TypeInitializationException
Message="The type initializer for 'ServiceStack.Text.Jsv.JsvWriter`1' threw an exception."
Source="ServiceStack.Text"
TypeName="ServiceStack.Text.Jsv.JsvWriter`1"
StackTrace:
at ServiceStack.Text.Jsv.JsvWriter`1.WriteFn()
at ServiceStack.Text.Jsv.JsvWriter.GetWriteFn(Type type) in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\JsvWriter.Generic.cs:line 39
at ServiceStack.Text.Jsv.WriteType`1.GetWriteFn() in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\WriteType.cs:line 51
at ServiceStack.Text.Jsv.WriteType`1..cctor() in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\WriteType.cs:line 27
InnerException: System.TypeInitializationException
Message="The type initializer for 'ServiceStack.Text.Jsv.WriteType`1' threw an exception."
Source="ServiceStack.Text"
TypeName="ServiceStack.Text.Jsv.WriteType`1"
StackTrace:
at ServiceStack.Text.Jsv.WriteType`1.get_Write() in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\WriteType.cs:line 32
at ServiceStack.Text.Jsv.JsvWriter`1.GetWriteFn() in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\JsvWriter.Generic.cs:line 205
at ServiceStack.Text.Jsv.JsvWriter`1..cctor() in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\JsvWriter.Generic.cs:line 106
InnerException: System.TypeInitializationException
Message="The type initializer for 'ServiceStack.Text.Jsv.JsvWriter`1' threw an exception."
Source="ServiceStack.Text"
TypeName="ServiceStack.Text.Jsv.JsvWriter`1"
StackTrace:
at ServiceStack.Text.Jsv.JsvWriter`1.WriteFn()
at ServiceStack.Text.Jsv.JsvWriter.GetWriteFn(Type type) in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\JsvWriter.Generic.cs:line 39
at ServiceStack.Text.Jsv.WriteType`1.GetWriteFn() in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\WriteType.cs:line 51
at ServiceStack.Text.Jsv.WriteType`1..cctor() in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\WriteType.cs:line 27
InnerException: System.TypeInitializationException
Message="The type initializer for 'ServiceStack.Text.Jsv.WriteType`1' threw an exception."
Source="ServiceStack.Text"
TypeName="ServiceStack.Text.Jsv.WriteType`1"
StackTrace:
at ServiceStack.Text.Jsv.WriteType`1.get_Write() in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\WriteType.cs:line 32
at ServiceStack.Text.Jsv.JsvWriter`1.GetWriteFn() in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\JsvWriter.Generic.cs:line 205
at ServiceStack.Text.Jsv.JsvWriter`1..cctor() in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\JsvWriter.Generic.cs:line 106
InnerException: System.ArgumentException
Message="An item with the same key has already been added."
Source="mscorlib"
StackTrace:
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at ServiceStack.Text.Jsv.JsvWriter.GetWriteFn(Type type) in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\JsvWriter.Generic.cs:line 40
at ServiceStack.Text.Jsv.WriteType`1.GetWriteFn() in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\WriteType.cs:line 51
at ServiceStack.Text.Jsv.WriteType`1..cctor() in C:\Projects\servicestack\Common\ServiceStack.Text\ServiceStack.Text\Jsv\WriteType.cs:line 27
InnerException:
Original issue reported on code.google.com by [email protected]
on 16 Jun 2010 at 9:27
What steps will reproduce the problem?
1. In Redis PUBLISH command will return number of receivers-subscribers. In
ServiceStack.Redis (commands Publish, PublishMessage) no number of receivers is
returned.
void PublishMessage(string toChannel, string message);
should be:
int PublishMessage(string toChannel, string message);
What is the expected output? What do you see instead?
More details on the PUBLISH command (from
http://code.google.com/p/redis/wiki/PublishSubscribe)
The Publish command is a bulk command where the first argument is the target
class, and the second argument the data to send. It returns an Integer Reply
representing the number of clients that received the message (that is, the
number of clients that were listening for this class).
What version of the product are you using? On what operating system?
svn checkout 21.11.2010
Please provide any additional information below.
Above feature is necessary in examples, where we publish message and start a
counter (opencases) (redis.IncrBy) with number of recipients. Counter gets
decremented on every reply received... When opencases=0 we must start following
actions.
Original issue reported on code.google.com by [email protected]
on 21 Nov 2010 at 1:51
redis for windows fails (windows server 2008 R2 x64, 4Gb of RAM) with out of
memory when after 700 mb of writes, version 1.2.6. So I've a question was it
build for x64 systems of for 32 ? This could be the answer because that's
typical for 32-bit programs to fail from out of memory even if there are
still a lot of memory because of RAM fragmentation
Original issue reported on code.google.com by [email protected]
on 24 Apr 2010 at 11:40
In multithreaded environement, with multiple pools, my script throw
"Cannot add unknown client back to the pool exception" exception from
DisposeClient.
it seems when client had exceptions, there is a call to DisposeConnection()
but when the client is disposed, DisposeClient is called.
ClientManager need to be set to null in DisposeClient ?
Original issue reported on code.google.com by [email protected]
on 3 Sep 2010 at 4:53
It takes a while for google to propagate the new downloads, so attaching new
releases to this comment.
Original issue reported on code.google.com by [email protected]
on 30 Aug 2010 at 10:15
What steps will reproduce the problem?
1. Persist a decimal into SqlServer database table (e.g. 0.175)
What is the expected output? What do you see instead?
Expected: Should persist value correctly (0.175).
Actual: rounds value to nearest integer (1)
Please provide any additional information below.
Sql Server by default creates the decimal column with precision (18,0). i.e not
allowing for decimal places.
Fixed this by changing DecimalColumnDefinition in the
SqlServerOrmLiteDialectProvider to "DECIMAL(38,6)".
Original issue reported on code.google.com by [email protected]
on 20 Jul 2010 at 3:40
var item = new b
{
Email = "[email protected]",
Password = "text",
FirstName = "Jim Smith",
Id = 4
};
Console.WriteLine(item.ToValueObject().Dump());
this.GetTypedClient().Store(item.ToValueObject());
this.GetTypedClient().ExpireEntryIn("4", TimeSpan.FromSeconds(20));
var fromCache = this.GetTypedClient().GetById("4");
Console.WriteLine(fromCache.Dump());
where this.GetTypedClient is this
public IRedisTypedClient<DTOb> GetTypedClient()
{
return rc.GetTypedClient<DTOb>();
}
so my question - why
this.GetTypedClient().ExpireEntryIn("4", TimeSpan.FromSeconds(20));
doesn't make entry with id=4 expired in 20 seconds. It seems "Store" method
doesn't change the behavior regardless of ExpireEntryIn.
please let me know how can I use typed client + store values in redis which
will be expiring in X seconds?
Original issue reported on code.google.com by [email protected]
on 14 Jul 2010 at 11:07
Hello,
I'm currently encountering a small issue with the JSV serializer. It's easy to
reproduce :
1. Serialize an object with a Float/Double/Decimal property
2. Deserialize the object.
3. Compare both object
When I compare my deserialized object with the original, the original double
value 0.4047479892171677 is not equal to the deserialized value
0.404747989217168.
The value has been rounded up, but I can't find any explanation in the "JSV"
format documentation.
Original issue reported on code.google.com by [email protected]
on 15 Nov 2010 at 2:14
Performing command operations within a loop causes a significant amount of
time to be spent within the redis operation.
In the following example code takes 40 seconds to execute the loop.
The trans.Commit() command that follows is immediate.
What is the cause of this?
using (var trans = this.redisClient.CreateTransaction())
{
string keyMaster = "key:";
string valueMaster = "value:";
for (int i = 0; i < 1000; i++)
{
string key = keyMaster + i.ToString();
trans.QueueCommand(r => r.Set(key, valueMaster));
}
trans.Commit();
for (int i = 0; i < 1000; i++)
{
string key = keyMaster + i.ToString();
this.redisClient.Get<string>(key);
}
}
Original issue reported on code.google.com by [email protected]
on 19 May 2010 at 10:29
When my culture is pt-BR one of my objects is inserted into redis as:
{Latitude:-23,5707,Longitude:-46,57239}
As you can see, in this culture the decimal separator is the same as the
field separator and JsvReader can't read it and throws a
IndexOutOfRangeException.
A workaround is to set the current culture to CultureInfo.InvariantCulture,
but I would like it to work in any culture.
I know this is mainly a .NET bug, that JsvSerializer and JsvReader should
be internationalized, but as .NET bugs won't be solved as fast as we need,
I think this library should provide a workaround for this bug.
Original issue reported on code.google.com by [email protected]
on 28 May 2010 at 3:07
I am using servicestack TypeSerializer.
I am getting exception when the structure variable contains escape characters.
How could I handle this issue?
Original issue reported on code.google.com by [email protected]
on 26 Oct 2010 at 4:47
Hello!
In my company we have a pretty big service that currently uses WCF for its
communication. Now we are looking into moving to the Mono platform and
therefore i am looking for a replacement.
ServiceStack seems to be the closest to what we want. I would really like
to see the POST/LIST/GET/DELETE http commands available, as i can see on
the wishlist. Furthurmore it would be nice to be able to use hierachy such as:
Users (POST,GET,LIST)
Users/5/ (GET/DELETE user number 5)
Users/5/Reports (POST,GET,LIST)
Users/5/Reports/1 (GET/DELETE report number 1 of user number 5)
...
Is this something that you have in plan for the close future? I might just
implement it myself and send you the diff.
Anyway, great work :)
Original issue reported on code.google.com by [email protected]
on 27 Apr 2010 at 6:22
When 2 sites share the same FormsAuthentication configuration, one can login to
site #1 and simultaneously be authenticated for site #2. It would be cool if
this principle could be persisted for web services to enable easy and
lightweight transparent authentication among sibling sites.
It actually takes very little effort in order to enable this, though I'm not
sure whether it would introduce unwanted dependencies. Anyway, whenever a
WebRequest.Create is issued (like in ServiceClientBase.SendRequest), for this
to work, it should be decorated with the current cookies:
var cookie =
HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
if (cookie != null)
{
var authenticationCookie = new Cookie(
FormsAuthentication.FormsCookieName,
cookie.Value,
cookie.Path,
HttpContext.Current.Request.Url.Authority);
httpWebRequest.CookieContainer = new CookieContainer();
httpWebRequest.CookieContainer.Add(authenticationCookie);
}
Original issue reported on code.google.com by [email protected]
on 24 Aug 2010 at 12:45
What steps will reproduce the problem?
1. Attempt to bind to webservice from Visual Studio
2. Or from SoapUI
3.
What is the expected output? What do you see instead?
A valid binding
What version of the product are you using? On what operating system?
current release binaries on win7 x86
Please provide any additional information below.
Original issue reported on code.google.com by LepardUK
on 27 Sep 2010 at 2:16
What steps will reproduce the problem?
1.Create a console client and a use the built in webserver in VS2010 to host
the web service
2.Made a call to the webservice and you will get bad request.
What is the expected output? What do you see instead?
response from webservice. instead you get bad request. using TCPMon you can
see that JsvServiceClient and JsonServiceClient with a base address of
"http://localhost:8080/Public/" request /Public/Jsv/SyncReply//GetFactorial
instead of /Public/Jsv/SyncReply/GetFactorial. With the extra / in the request
the webserver returns Bad Request message instead of the result. Please not
removing the extra / does make the service work.
What version of the product are you using? On what operating system?
v1.38 on VS2010 built in web server
Please provide any additional information below.
I have no idea why the extra / is added to the URL but hopefully it is not to
hard to fix. I have included the error page as an attachment.
Original issue reported on code.google.com by [email protected]
on 29 Jul 2010 at 12:17
Attachments:
Right now, if a call is attempted to a service that does not exist, a
null-value exception is created. Do I have a configuration error somewhere or
is it possible to make a change so that a 404 response is created instead of an
exception?
Thanks,
Dave
Original issue reported on code.google.com by dave.w.murphy
on 22 Jun 2010 at 4:51
What steps will reproduce the problem?
1.Created one custom struct (like C# Point)
2.Created instances for my structure
3.Tried to serialize using JsonSerializer and TypeSerializer
What is the expected output? What do you see instead?
It hols the type information instead data
Please provide any additional information below.
Attached sample code
Original issue reported on code.google.com by [email protected]
on 12 Oct 2010 at 5:00
Attachments:
What steps will reproduce the problem?
List<string> keystoget = new List<string>();
keystoget.Add("key1");
keystoget.Add("key2");
keystoget.Add("NONEXISTANT key3");
keystoget.Add("key4");
getvaluesresult = redisPublisher2.GetValues(keystoget);
getvaluesresult.Count should return 4 strings, now it only returns 3.
Current result:
valueforkey1
valueforkey2
valueforkey4
Correct result:
valueforkey1
valueforkey2
null
valueforkey4
Since position is lost, result of key4 is now at position 3. It is not possible
to know which key was missing.
Another solution would be to return
Dictionary<string,string>, that would have key-value pair.
1.
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 21 Nov 2010 at 3:43
>What steps will reproduce the problem?
1. There is a cycles in an object model (e.g. Manager->Subordinate->Manager)
2. The following error occured: An item with the same key has already been
added.
at ServiceStack.Text.Jsv.JsvWriter`1.WriteObject(TextWriter writer, Object value)
at ServiceStack.Text.TypeSerializer`1.SerializeToString(T value)
at ServiceStack.Redis.Generic.RedisTypedClient`1.SerializeValue(T value)
at ServiceStack.Redis.Generic.RedisTypedClient`1.AddItemToList(IRedisList`1 fromList, T value)
at ServiceStack.Redis.Generic.RedisClientList`1.Add(T item)
at RedisClientPrototype.Tester.RedisClientTester.Run() in D:\projects\danware\wiseMo\prototype\RedisClientPrototype\RedisClientPrototype\Tester\RedisClientTester.cs:line 39
>What is the expected output? What do you see instead?
The expected result is the ability of the serializer to handle loops and
cycles. Currently the application just unfriendly dies with "type initializer
exception" :(
>What version of the product are you using? On what operating system?
I'm using latest release "Latest release of ServiceStack binaries only (v1.38)".
>Please provide any additional information below.
No additional information
Original issue reported on code.google.com by [email protected]
on 13 Jul 2010 at 11:23
Attachments:
This is more a feature request. I would like to use JSV like now, but I would
also want JSV to be able to serialize/deserialize the types of the stored
objects.
I know how to do that by myself with a simple object, but when you have several
nested objects, it starts to be complicated.
Maybe as an option? So, people can use both for POCO or for full class
serialization/deserialization.
Original issue reported on code.google.com by [email protected]
on 23 Sep 2010 at 4:07
What steps will reproduce the problem?
1. include servicestack.dll
2. include servicestack.redis.dll
3. include servicestack.interface.dll
What is the expected output? What do you see instead?
expected output is working, what happens is that interfaces and the like
are shared between servicestack.redis.dll and servicestack.dll.
What version of the product are you using? On what operating system?
1.0.5, windows. .net 3.5
Original issue reported on code.google.com by [email protected]
on 17 Mar 2010 at 8:42
I can't tell without looking into the source code why I need to send a ulong
to this method
namespace ServiceStack.CacheAccess.Memcached
{
public class MemcachedClientCache
{
public bool CheckAndSet(string key, object value, ulong cas);
Original issue reported on code.google.com by [email protected]
on 1 Jun 2010 at 8:22
Deserialize the string dictionary
{p1:v1,p2:v2,p3:}
ParseUtils.EatMapValue throws an exception because value[i] is called
before the check on value.Length.
Original issue reported on code.google.com by [email protected]
on 25 Apr 2010 at 7:17
What steps will reproduce the problem?
1. build project
2. view wsdl for soap11 or soap12
3.
What is the expected output? What do you see instead?
<wsdl:definitions name="Soap11"
targetNamespace="http://services.<MYDOMAINHERE>/">
<wsdl:definitions name="Soap11"
targetNamespace="http://services.servicestack.net/">
What version of the product are you using? On what operating system?
latest version on windows 7
Please provide any additional information below.
I have found where to override most of the default config to see the values I
want. how can I change the values read from WsdlTemplateBase or do I need to
custom compile the common project?
Original issue reported on code.google.com by LepardUK
on 18 Oct 2010 at 12:00
Given the following class:
public class C
{
public int? A { get; set; }
public int? B { get; set; }
}
The following statements do not show correct output:
var c1 = new C { A = 1, B = 2 };
var c2 = new C { A = null, B = 2 };
var s1 = QueryStringSerializer.SerializeToString(c1); // = "A=1&B=2"
var s2 = QueryStringSerializer.SerializeToString(c2); // = ""
After some testing it appears all null properties will lead to following
properties not being output. I think it's due to WriteQueryString in
ServiceStack.Text.Common.WriteType
:
foreach (var propertyWriter in PropertyWriters)
{
var propertyValue = propertyWriter.GetterFn((T)value);
if (propertyValue == null) return;
...
}
Looks like that return should be a break.
Original issue reported on code.google.com by [email protected]
on 25 Aug 2010 at 6:39
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.