Well, giving further clarification, that is what I will do.
Remaining in line with the care taken by GraemeF, doing what you want is fragile and prone to cracking at best.
In this regard, the general practice is to consider support for development-time data as a completely different approach, and then support for run-time data. Very simply, the connection you create between your temporary development environment and this database is a bad idea.
To just provide design-time data for visualization, I prefer to use the mock class, which adheres to the common interface as the runtime class. This gives me a way to show the data that I can provide of the correct type and conforms to the same contract as my runtime object. However, this is a completely different class that is used to support development time (and is often used for Unit Testing).
For example. If I had a runtime class that should show the personβs data, such as first name, last name and email address:
public class Person() { public String FirstName { get; set;} public String LastName {get; set;} public Email EmailAddress {get; set;} }
and I populated this object from the database at runtime, but should also provide a visualization of the development time. I would introduce the IPerson interface, which defines the contract to which it is bound, namely, provides that getters properties exist:
public interface IPerson() { String FirstName { get; } String LastName { get; } Email EmailAddress { get; } }
Then I would update my runtime Person class to implement the interface:
public class Person() : IPerson { public String FirstName { get; set;} public String LastName {get; set;} public Email EmailAddress {get; set;} }
Then I would create a mock class that implements the same interface and provides reasonable values ββfor using development time
public MockPerson() : IPerson { public String FirstName { get { return "John"; } } public String LastName { get { return "Smith"; } } public Email EmailAddress { get { return new Email(" John@smith.com "); } } }
Then I would implement a mechanism for providing a MockPerson object at design time and a real Person object at run time. Something like this or this . This provides support for development-time data without a tight relationship between the runtime and development time.
This template is much more flexible and allows you to provide ongoing support for development-time data in your application.