Implement Dependency Injection for interfaces or other properties.
Example:
class LoginModel : Model
{
[Autowired]
IDatabase Database { get; }
}
Jellyfish should automatically find the IDatabase implementation (or it is pre-configured before initialization), and initialize the Database { get; } property with that instance. The IDatabase instance is either already initialized somewhere (👍) or initialized by the default constructor (👎)
Example 2:
class LoginModel : Model
{
IDatabase Database { get; }
public LoginModel(IDatabase database)
{
Database = database;
}
}
Implement Dependency Injection for interfaces or other properties.
Example:
Jellyfish should automatically find the
IDatabase
implementation (or it is pre-configured before initialization), and initialize theDatabase { get; }
property with that instance. TheIDatabase
instance is either already initialized somewhere (👍) or initialized by the default constructor (👎)Example 2: