Summary: This sample .NET code is for course ISC1134 - Stock Trading with .NET. For access to this course, register and login at learning.intersystems.com and then navigate to the course page: Stock Trading with .NET
We recommend you use either Viusual Studio or Visual Studio Code to run this sample code.
- ADO.NET Sample code - Connect your .NET application to InterSystems IRIS using ADO.NET to store and retrieve data with SQL.
- XEP Sample code - Connect your .NET application to InterSystems IRIS to store real-time objects.
- Native API Sample code - Connect your .NET application to InterSystems IRIS to store data natively and use methods built within InterSystems IRIS.
- Multi-model Sample code - Use ADO.NET, Native API, and XEP side-by-side to query data relationally, populate values using methods written within InterSystems IRIS, and store objects directly.
- Entity Framework Sample code - Use the third-party tool, Entity Framework, to do object relational mapping and interact with data in InterSystems IRIS.
Any and all code provided in these materials is provided solely for demonstrative and illustrative purposes and is not intended for use in production.
-
Verify you have an instance of InterSystems IRIS, and an IDE that supports .NET (such as Visual Studio). If you are using AWS, Azure, or GCP, verify that you have followed the steps to change the password for InterSystems IRIS.
-
If you are using AWS, GCP, or Microsoft Azure, load the sample stock data into InterSystems IRIS:
$ iris load http://github.com/intersystems/Samples-Stock-Data
If you are using InterSystems Labs, the sample stock data is already loaded. You can skip to the next step. -
Clone this repo into your machine. All code files located inside Solutions folder.
NOTE: This tutorial show how to connect to InterSystems IRIS using XEP. Setting up ADO.NET, the Native API, and multi-model is similar to XEP. Set up process for Entity Framework is complicated. Please go to the Stock Trading course for more details.
In Visual Studio Code:
-
Open the repo in your IDE.
-
Copy
C#.csproj
,InterSystems.Data.IRISClient.dll
,InterSystems.Data.XEP.dll
from enviroment folder into your working directory. Put those 3 files in Solutions/XEP folder. -
In the
xepplaystocks.cs
file, modify the ip and password to be the correct values for your InterSystems IRIS instance. Although port and username are most likely the defaults, you should verify that the values are correct. -
Note that Entity Framework only run in Visual Studio, so please switch to Visual Studio if you want to experience it.
-
In the terminal of Visual Studio Code:
- Navigate to working directory:
cd Solutions/XEP
- Run:
dotnet run
In Visual Studio:
- Create new project: Select File ---> New --> Project. Choose Console App(.NET Framework).
- Copy the
trade.cs
andxepplaystocks.cs
from the XEP folder you recently cloned. - In the
xepplaystocks.cs
file, modify the ip and password to be the correct values for your InterSystems IRIS instance. Although port and username are most likely the defaults, you should verify that the values are correct. - Execute the code.