Archived
This forum has been archived. Please start a new discussion on GitHub.
slice2cs --> virtual functions
Hi,
is there a way to instruct the slice2cs compiler to produce classes with virtual members?
Regards,
Dmitry.
is there a way to instruct the slice2cs compiler to produce classes with virtual members?
Regards,
Dmitry.
0
Comments
-
Hi Dmitry,
I'm afraid there's no way to do that. Can you give us an example to show how this would be useful?
Regards,
Mark0 -
virtual members or interfacesHi Dmitry,
I'm afraid there's no way to do that. Can you give us an example to show how this would be useful?
Regards,
Mark
Hi, Mark.
Example:
1. A LogWriter services which stores LogEntrys in a database using the NHibernate ORM library;
2. The LogEntry is defined in an *.ice file as a struct and therefore is rendered into a class with public members.
3. In terms of the NHibernate the LogEntry is a persistent class which is required to have its public members to be virtual, so that the NHibernate is able to store/restore the class from the database;
Without LogEntry's properties being virtual I have to create a special persistent class for the LogEntry with virtual members (say NHLogEntry), and copy data from the LogEntry instance at run-time to the NHLogEntry object.
Should I be able to instruct the slice2cs somehow to produce virtual members of generated classes I would not need to establish special persistent classes for the NHibernate - any class (struct in terms of slice) could participate naturally in this storing business.
Mark,
there is one more possibility to make a class NHibernate-compatible. Any class can be stored to a database if, at design-time, it inherits an interface. In other words, should it be possible to produce interfaces along with classes from slice definitions it would be sufficient for the NHibernate to store them in a database.
Regards,
Dmitry.0