Class Connector
Inherited Members
Namespace: LemonEdge.API.Client.CommonUI
Assembly: LemonEdge.API.dll
Syntax
public class Connector : IConnector, IUpdateServiceConnection
Constructors
Connector(IDataUpdaterFactory, IDatabaseStatusProxy)
Declaration
public Connector(IDataUpdaterFactory factory, IDatabaseStatusProxy databaseStatusProxy)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataUpdaterFactory | factory | |
| IDatabaseStatusProxy | databaseStatusProxy |
Fields
ID
Declaration
public readonly Guid ID
Field Value
| Type | Description |
|---|---|
| Guid |
Properties
CurrentServiceConnection
The current connection settings
Declaration
public string CurrentServiceConnection { get; }
Property Value
| Type | Description |
|---|---|
| string |
Instance
Declaration
public static IConnector Instance { get; set; }
Property Value
| Type | Description |
|---|---|
| IConnector |
IsUserFromRootAccount
Indicates if the current logged in user is part of the root account of the connected database.
Root accounts have greater access to what can be modified in the system
Declaration
public bool IsUserFromRootAccount { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Licenser
Returns the ILicenser to validate the application license.
Declaration
public ILicenser Licenser { get; init; }
Property Value
| Type | Description |
|---|---|
| ILicenser |
LoggedInUser
The user information for the current logged in user
Declaration
public UserInfo LoggedInUser { get; set; }
Property Value
| Type | Description |
|---|---|
| UserInfo |
Type
The type of connection that the underlying provider is supporting.
Declaration
public ConnectionType Type { get; }
Property Value
| Type | Description |
|---|---|
| ConnectionType |
Methods
Create()
If the system has logged in this will create and return an IEntityUpdaterUI for querying, retrieving and modifying all entities in the system
Declaration
public Task<IEntityUpdaterUI> Create()
Returns
| Type | Description |
|---|---|
| Task<IEntityUpdaterUI> | An IEntityUpdaterUI for querying, retrieving and modifying all entities in the system |
CreateAuthenticator()
Creates an IAuthenticator to allow user login.
Declaration
public IAuthenticator CreateAuthenticator()
Returns
| Type | Description |
|---|---|
| IAuthenticator | The IAuthenticator. |
CreateDatabaseStatusProxy()
Creates an IDatabaseStatusProxy to check database status.
Declaration
public IDatabaseStatusProxy CreateDatabaseStatusProxy()
Returns
| Type | Description |
|---|---|
| IDatabaseStatusProxy | The IAuthenticator. |
CreateStorageManager()
Creates the appropriate IStorageManager for the current connection type
Declaration
public IStorageManager CreateStorageManager()
Returns
| Type | Description |
|---|---|
| IStorageManager |
LoggedInUniqueConnection()
Returns the unique connection for the current login
Used for verifying local stored caches can be reused for the correct connections
Declaration
public string LoggedInUniqueConnection()
Returns
| Type | Description |
|---|---|
| string | The unique connection for the current login |
LoggedInUserFriendlyConnection(IReadOnlyCache, bool)
Returns a user friendly string of the current connection, including any currently active canvas, and invalid license info
Declaration
public Task<(string Title, Color? HighlightColour, Color? HighlightColour2)> LoggedInUserFriendlyConnection(IReadOnlyCache cache, bool shortVersion = false)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyCache | cache | The current local cache |
| bool | shortVersion | Indicates if the string returned should be a short version for smaller restricted screens such as mobiles |
Returns
| Type | Description |
|---|---|
| Task<(string Title, Color? HighlightColour, Color? HighlightColour2)> | A user friendly string of the current connection, including any currently active canvas, and invalid license info |
Login(string, string, bool)
Logs into the LemonEdge system using the specified user and password
Declaration
public Task<UserInfo> Login(string userName, string password, bool reloadDynamicEntities = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | userName | The username to login with |
| string | password | The plain text password of the user to login with. The plain text is encrypted by this function before being sent anywhere. |
| bool | reloadDynamicEntities | Flag for reloading add-ins and custom objects/lists |
Returns
| Type | Description |
|---|---|
| Task<UserInfo> | The UserInfo for the logged in user if login was successful. An error is thrown otherwise. |
LoginExternal(bool)
Logs into the LemonEdge system using the current external token
Declaration
public Task<UserInfo> LoginExternal(bool reloadDynamicEntities = false)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | reloadDynamicEntities | Flag for reloading add-ins and custom objects/lists |
Returns
| Type | Description |
|---|---|
| Task<UserInfo> | The UserInfo for the logged in user if login was successful. An error is thrown otherwise. |
LoginWindows(bool)
Logs into the LemonEdge system using the current windows domain name user
Declaration
public Task<UserInfo> LoginWindows(bool reloadDynamicEntities = false)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | reloadDynamicEntities | Flag for reloading add-ins and custom objects/lists |
Returns
| Type | Description |
|---|---|
| Task<UserInfo> | The UserInfo for the logged in user if login was successful. An error is thrown otherwise. |
Logout()
Sets the Logged In User to null.
Declaration
public void Logout()
Reconnect()
Reconnects to the current service connection, validating the model again
Declaration
public Task Reconnect()
Returns
| Type | Description |
|---|---|
| Task | A task indicating the completion of the operation |
RefreshUser()
when doing a refresh all we should refresh the user. It's possible the user logs in to two clients on the same pc this would ensure if they switch canvas/team/etc that they are consistent across clients with the server version.
Declaration
public Task RefreshUser()
Returns
| Type | Description |
|---|---|
| Task |
Reset()
Declaration
public static void Reset()
UpdateServiceConnection(string, bool)
Indicates we should use the specified connection url for connecting to a web service
This takes time to complete as the system verifies the webs service, and downloads the model of the webservice it is connecting to (as LemonEdge services can have different models depending on the addins)
Declaration
public Task UpdateServiceConnection(string connection, bool force = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | connection | A valid url connection to a LemonEdge web service |
| bool | force | Whether to force a refresh of an existing connection. |
Returns
| Type | Description |
|---|---|
| Task | A task indicating the completion of the operation |