Results 1 to 4 of 4

Thread: Is it posible to work with database from different applications?

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    9

    Default Is it posible to work with database from different applications?

    Example.
    1. I defined a custom class with primitive properties in one .net application and saved some data of that type in the database.
    2. I defined such class in another .net application and try to get data from the database. But I can not get it. I think, the problem is that two classes are defined in different assemblies.

    Is it possible to read/write data from different applications if they have similar classes?
    Last edited by spetrik; 31.01.2012 at 05:41.

  2. #2

    Default

    I think, the problem is that two classes are defined in different assemblies.
    Yes, because the two types are different from the .NET point of view, although they have the same properties, fields etc.

    Is it possible to read/write data from different applications if they have similar classes?
    No, because the STSdb R3.5.x version is strongly typed database system. It keeps indirectly the record type, by serializing the IBinaryPersist<IIndexer<TRecord>> instance (which is responsible of how the data are stored) of each XTable<TKey,TRecord> within the database file.

    If you want to use the database from a different applications, you have to outsource the record class in a common assembly.
    Last edited by k.dimova; 13.06.2013 at 16:23.

  3. #3
    Junior Member
    Join Date
    Oct 2011
    Posts
    9

    Default

    Another way is:
    1. Store data in a database as stream or byte array.
    2. Create proxy function which convert data to/from custom class from/to stream.
    3. Before saving data to a database you must to convert data from custom class to stream.
    4. Read data from a database as stream and convert it into object of custom class using proxy function.

    In any case many thanks to STSdb team for amazing database.

  4. #4

    Default

    Yes, it is also a way...

    Another way is to make a vertical table split. If you have
    XTable<TKey,TRecord> table;
    
    you can split it to several primitive tables:
    XTable<TKey,TProperty1> table1;
    XTable<TKey,TProperty2> table2;
    XTable<TKey,TProperty3> table3;
    ...
    
    where TPropertyN are the primitive sub-types of the TRecord type.

    If you don't need top usage speed, this variant is also possible. Moreover, that the system space in a XTable usually takes less than 1% of the total table data, so you will not sacrifice too much space by storing the keys several times...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
2002 - 2014 STS Soft SC. All Rights reserved.
STSdb, Waterfall Tree and WTree are registered trademarks of STS Soft SC.