various problems with first test app


Author
Message
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
I have built a bo library that corresponds to 3 tables in my database. The one I am working with is a table of users. It is my intention to test the new serialize to stream function.



There are 3 issues here



The table schema looks like this:

new DataColumn("ID", typeof(System.String)),

new DataColumn("LAST_NAME", typeof(System.String)),

new DataColumn("FIRST_NAME", typeof(System.String)),

new DataColumn("MI", typeof(System.String)),

new DataColumn("TITLE", typeof(System.String)),

new DataColumn("LIC_NO", typeof(System.String)),

new DataColumn("DEA", typeof(System.String)),

new DataColumn("EMP_NO", typeof(System.String)),

new DataColumn("INSVC_DATE", typeof(System.DateTime)),

new DataColumn("OSVC_DATE", typeof(System.DateTime))

etc...





I created a Strataframe windows app and added boAllUsers1 instance to the form and added a button with the follwoing handler:



private void button1_Click(object sender, EventArgs e)

{

Stream myStream;

boAllUsers1.NewRow();

boAllUsers1.ID = "FRED";

boAllUsers1.SerializeToStream(myStream);

BOLibrary.boAllUsers allUsers = (BOLibrary.boAllUsers)BusinessLayer.DeserializeBusinessObject(myStream);

MessageBox.Show(allUsers.ID);

}



1)---------------------------------------------------------------

The first error I get is in the attached jpeg and I don't understand it.



2)---------------------------------------------------------------

The second error is when I try to execute:

boAllUsers1.ID = "FRED";



The error is:

{"Input string was not in a correct format.Couldn't store in ID Column. Expected type is Int32."}



Since this is a string field in the DB and the BO was built knowing that it is a string field, why is it complaining that I cannot put a string in an integer field?



3)---------------------------------------------------------------

Since .NET does not provide a constructor that will create a new empty stream, perhaps it would be better if SerializeToStream returned a Stream and SerializeToByteArray returned a ByteArray rather than taking them as input parameters?



Thank you
Attachments
assembly version conflicts.jpg (230 views, 15.00 KB)
Reply
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
In order to separate operational issues from philosophical discussion, I have posted the errors that occurred when trying to use this function in a separate message.



As far as the philosophical issues is concerned, I have a preference for functions like this returning an object as a result for the following reasons:



1) It makes it possible to nest the function that creates the new stream within a function call that consumes the stream.



2) If I read the .NET framework correctly (please correct me if necessary as I am kind of new to this area of .NET), there are only 4 basic types of streams: MemoryStream, FileStream, BufferedStream and .Net.NetworkStream. Any other type of stream that one chose to create would be done by subclassing one of these. This would admit several solutions to introducing a function that returned a new stream:



a) Create 4 functions. SerializeToMemoryStream, SerializeToFileStream, SerializeToBufferedStream and SerializeToNetworkStream.



b) Create the SerializeToStream function to take an enum as the input parameter. The Enum would be something like:



enum SerializeToStreamType{

MemoryStream,

FileStream,

BufferedStream

NetworkStream }



In either case if the user was working with a custom class that was subclassed from one of these, they could cast the return value to the type of their custom class.



3) It would create a syntactic unity between SerializeToStream and SerializeToByteArray which would soothe by obsessive, compulsive soul.



Clearly what you have created so far is workable (with the exception of the issues raised in the other post). If what I have suggested is really not possible because of other technical factors that you understand better than I, I can certainly live with it the way it is. I hope I have at least done an adequate job of explaining my preference and why I raised the issue.



Thank you.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search