Overriding Constructors in F#
Posted
by kim3er
on Stack Overflow
See other posts from Stack Overflow
or by kim3er
Published on 2010-04-02T13:22:07Z
Indexed on
2010/04/02
14:13 UTC
Read the original article
Hit count: 414
How would I write the following C# code in F#?
namespace Shared {
public class SharedRegistry : PageRegistry {
public SharedRegistry(bool useCache = true)
: base(useCache) {
// Repositories
ForRequestedType<IAddressRepository>().TheDefaultIsConcreteType<SqlAddressRepository>();
ForRequestedType<ISharedEnquiryRepository>().TheDefaultIsConcreteType<SharedEnquiryRepository>();
// Services
ForRequestedType<IAddressService>().TheDefaultIsConcreteType<AddressService>();
ForRequestedType<ISharedEnquiryService>().TheDefaultIsConcreteType<SharedEnquiryService>();
}
}
}
As is as far as I have managed, but I can't work out to inherit from PageRegistry
at the same time as declaring my own default constructor.
type SharedRegistry(useCache: bool) =
inherit PageRegistry(useCache)
new() = new SharedRegistry(true)
Rich
© Stack Overflow or respective owner