While developing applications with Kuika, you can use various data sources and create Custom Action with various tools. One of the data sources and Custom Action creation tools you can use is C#.
With Kuika, you can quickly integrate C# into your project during the application development process.
A. Data Source Connection and Custom Action Creation with C#
To make data source connection with C# and create Custom Action, go to Datasources view mode in the project you are working on in Kuika.
Through the left menu in the Datasources view mode, you can view the data sources, actions and tables in the application you have developed, add a new data source, a new action and a new table.
To add a new data source to the application you are developing, click the + icon opposite the Datasources heading.
To add a datasource to the application you developed with C# and create a Custom Action, select C# as Datasource type and name it. After completing the naming process, select the C# template. Below are the C# templates offered by Kuika.
After selecting the template, click the CREATE button.
You can make a data connection with the default C# functions or change the template on the pop-up screen.
You can change the template via the drop-down menu under the Template heading. To change the template, click on the drop-down menu under the Template heading. Select the template you need from the templates in the menu. In accordance with the template you have selected, the code content in the C# editor will be updated according to the template properties.
You can use the Custom Authentication Provider template to use custom authentication provider functions.
You can use the Custom Authorization Provider template to use custom authorization provider functions.
You can use the Verification Code Sender Provider template to authenticate users or send temporary or disposable codes for security purposes.
Write the data connection and Custom Action content in C# programming language according to the templates you have selected and create the Datasources connection by clicking the CREATE button.
By entering the appropriate prompt to the AI assistant added to the C# editor, you can create C# functions in seconds without writing any code.
Create a new C# Action under the C# header you added to the new data source from Datasources view mode.
Type the function name in the C# name field. You can continue writing the query directly in the C# editor.
In general terms, the improvements we made on the C# Actions Editor are given below;
1. Action Naming Field
With the C# Actions name field you can add or update the action name. You can use English characters in the naming and also the special characters “-” or “_”.
2. C# Template Field
There are C# Datasource templates such as Default C# Function, Custom Authentication Provider and Custom Authorization Provider. You can select the template you need from this field and add it to the editor.
The change you make in this field deletes the script you previously wrote in the Editor.
3. AI Assistant for C# Functions
When writing your C# functions, you can quickly prepare them with AI support. Open the chat area with Generate with AI from the top section. Define the function you want to create.
"Hello world rotating function”
Prepare a function related to artificial intelligence. You can copy the prepared function.
4. Adding C# functions to C# Editor
You can click the blue button to add the copied function to the C# Editor.
5. Registering C# functions
After adding functions to the C# Editor, you can create the function you have prepared by clicking the CREATE button, and when you open a saved function, you can update it with the UPDATE button.
Custom Authentication Provider, is a special or customised authentication provider. Generally, it is suitable for standard authentication solutions, but for some special requirements or functions, standard authentication methods may be insufficient. Therefore, a customised authentication provider is a specially created structure to authenticate users and ensure security.
To create Custom Authentication Provider, open Datasources view mode via Header. On the screen that opens, click the + icon on the left panel. Then select C# from the Select Type field.
Name the Datasource you created. Select Custom Authentication Provider from the Selectbox and click the Create button.
The generated Custom Authentication Provider is opened with a predefined class. This code contains a C# class and an instantiation of a class that implements a custom authentication provider. This class provides customised functionality for user authentication and contains comments to describe this functionality.
The Custom Authentication class implements the Custom Authentication interface. This interface defines the authentication functions.
In the code, Login, Refresh Token, Find Manager and Logout methods are provided ready for users.
In Custom Authentication Provider, areas where return null values are not returned are valid. The values in the quika are considered invalid, and the values in the quika are valid where return null is returned.
The explanations are written to facilitate the use and customisation of the code. They are included to guide developers who want to customise the user authentication of the code. In this way, developers can use this code to implement the authentication logic of a particular application or system as they wish.
Custom Authorization Provider, is used to create a customised authentication and authorisation system.
To create Custom Authorisation Provider, click Datasources in the Header field. On the screen that opens, click the + icon on the left. Then select C# from the Select Type field. Name the Datasource you created. Select Custom Authorisation Provider from the Selectbox and click the Create button.
Custom Authorisation Provider represents a special authentication class. It is used to retrieve the user's roles within the application. Custom Authorisation allows Custom Authorisation to retrieve from different systems (Azure, Custom DB...) which roles are available for each user on the screen on the Web or Mobile side at the opening of each screen within the application.
Kuika provides a ready-made C# predefined function in Custom Authorisation for the user. This function contains the following methods and variables:
GetRoles Method:
The Get Roles method returns which roles the user has in the application. This method takes the following parameters:
The comments provided in the script contain important information about how the script should be used. In particular, the developer is told that if it is desired to define custom roles, the relevant code should be opened and the list of appropriate roles should be inserted instead of the code fragment specified here.
This code can be used to customise the authentication and authorisation processes of an application. For example, you may want to define special roles for workers on a particular screen or application section. This class can be used to meet such requirements and provides developers with a starting point for customising roles.
Verification Code Sender Provider, is a service that an application or service uses to send verification codes to its users. This type of service is used to authenticate users or to send temporary or single-use codes for security purposes.
Verification Code Sender Provider can basically fulfil the following functions.
To receive the Verification Code by SMS or Notification other than e-mail, open the Datasources view mode via Header.
In this screen you need to create a new data source. For this, click on the + icon on the left. Select C# from the screen that opens. Then select Custom Verification Code Sender Provider from the Selectbox on the same screen.
With this selection, the Verification Code will be sent by the user. In the created Datasource, e-mail (User Name), User name and surname (First-Last Name), User Number (User Phone) information comes as parameters. This information is requested from the user.
If the user wants to send the code in which way (e-mail, notification...) on the Return False code block, it must be filled in as required.
After entering the relevant information, complete the process by clicking the CREATE button.