![]() ![]() NPC reciever = formatter.Deserialize(recieverStream) as NPC MemoryStream movedStream = new MemoryStream(enc.GetBytes(trace.Move)) MemoryStream firedStream = new MemoryStream(enc.GetBytes(trace.FiredBy)) MemoryStream recieverStream = new MemoryStream(enc.GetBytes(trace.Reciever)) TraceType traceType = (TraceType) Enum.Parse(typeof(TraceType), trace.TraceType) īinaryFormatter formatter = new BinaryFormatter() THIS IS HERE THE ERROR COMES public FightTrace CreateTrace(dbFightTrace trace) Where d.FightId=fightid & d.FiredAt > lastUpdateĬ# Factory, converting from LINQ to SQL class to my objects ![]() GameDataContext db = new GameDataContext() Ĭ# Code getting the entry in the database public List GetNewTraces(int fightid, DateTime lastUpdate) ((),reciever,move,fired,trace.DateTime,this.FightId) Ĭ# Code in Data access layer - Storing a record public void AddFightTrace(string type, string reciever, string Move, string firedBy, DateTime firedAt, int fightid) String move = Convert.ToBase64String(moveStream.ToArray()) String fired = Convert.ToBase64String(firedStream.ToArray()) String reciever = Convert.ToBase64String(recieverStream.ToArray()) MemoryStream moveStream = new MemoryStream() īinaryFormatter binaryFormatter = new BinaryFormatter() īinaryFormatter.Serialize(recieverStream,trace.Reciever) īinaryFormatter.Serialize(firedStream,trace.FiredBy) īinaryFormatter.Serialize(moveStream,trace.Move) MemoryStream firedStream = new MemoryStream() MemoryStream recieverStream = new MemoryStream() I cannot use BINARY as the length is around 15.000.Ĭ# Code in Business layer- Storing a record private void AddTraceToDatabase(FightTrace trace) I am trying to store random types of B and C in the database using LINQ to SQL, in a column with the type VARCHAR(MAX). I have a class A which is a base class, and then class B and C which are derived from A. The input stream is not a valid binary format. I have a problem with deserializing in C#/ASP.NET, which gives the exact error: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |