PR# 19933 How to combine Eiffel cluster with .NET Core main project

Problem Report Summary
Submitter: brotherbill@duck.com
Category: EiffelStudio
Priority: Medium
Date: 2024/07/06
Class: Support
Severity: Non-critical
Number: 19933
Release: 24.05
Confidential: No
Status: Analyzed
Responsible:
Environment: win
Synopsis: How to combine Eiffel cluster with .NET Core main project

Description
A very simple .NET Core MVC web application allows users to enter in a number, then get the square root of it.
The catch is that the precondition is x = 9 only.  (An artificial example)
The MVC application emulates this by throwing an exception when extracting the square root, where x is not 9.

There is an Eiffel Studio project that has two clusters, one for APPLICATION and one for MATH_MODEL.
The MATH_MODEL is equivalent to C# MathModel class.

The goal is to bring in the Eiffel cluster math_cluster with MATH_MODEL, and replace the C# MathModel.cs with Eiffel's MATH_MODEL, with re-wiring.

Please provide the EXACT steps to perform this delicate surgical operation.

On completion, this toy application will demonstrate how to bring Eiffel's DbC to .NET Core.

Then I can create the Udemy course: Eiffel for .NET Core applications.
This should work for MVC, Web API 2, Blazor and WPF.

Once you do this, I'll make a suggestion on clarifying your online documentation.

----------------------------------------------------------------------------

Download links:

Visual Studio Solution
    https://www.adrive.com/public/pVzaFa/BaseTester.zip

Eiffel Studio Application
    https://www.adrive.com/public/3Csy6y/base_tester.zip
To Reproduce
Run Visual Studio solution.
For Visual Studio Solution:
In browser, navigate to: localhost:5000
Click on Math Form link.
Type 9 in text box, then click button.
This displays 9 and the square root of 9.
Go back
Type 16 in text box, then click button.
This throws an exception, emulating a precondition.
Problem Report Interactions
From:brotherbill@duck.com    Date:2024/07/23    Status: Analyzed    Download   
I noticed a duplication of home_controller in both C# and Eiffel, as well as math_model.
In addition, error_view_model.e is added.

Were these Eiffel files hand created?
Is this a workaround for now?  I would expect that eventually Eiffel for .NET Core would be relatively simple to use with C# side.
When is this likely to occur?

From:jfiat_es    Date:2024/07/23    Status: Analyzed    Download   
We are working on fixing DbC support for .NetCore.
It will definitely be fixed for next release.

From:brotherbill@duck.com    Date:2024/07/23    Status: Open    Download   
You wrote: At the moment DbC on .NetCore is not working.

Eiffel without DbC is like a Porsche without brakes.
Is DbC in .NET Core simply commented out?
When is DbC for Eiffel for .NET Core expected to be "effective" ?
Would this be Eiffel 24.11?

From:jvelilla    Date:2024/07/22    Status: Open    Download   
I have created a simple application based on your C# code.

https://github.com/EiffelNETCore/examples/tree/main/web_apis/base_tester

At the moment DbC on .NetCore is not working.

If you have questions/suggestion about the examples,  use the github project 
so we can improve the code and the documentation.

>In https://github.com/EiffelNETCore/examples/tree/main/web_apis/my_first_api
>Compiling the Facade Library
>Navigate to the cs\asp_net_util folder.
>Execute the following command:
>dotnet build --output ..\..\..\my_first_api\packages

>This doesn't work.

I have fix the documentation, there was an issue in the path.

From:brotherbill@duck.com    Date:2024/07/22    Status: Open    Download   
In https://github.com/EiffelNETCore/examples/tree/main/web_apis/my_first_api
Compiling the Facade Library
Navigate to the cs\asp_net_util folder.
Execute the following command:
dotnet build --output ..\..\..\my_first_api\packages

This doesn't work.

Can we have a Zoom session where I can be guided to create and successfully run this Weather Forecasting app, mixing Eiffel for .NET Core with Visual Studio 2022?

Then I can carefully go through the working code and document it for tutorials.

From:jvelilla    Date:2024/07/15    Status: Open    Download   
Hi, I will check how to do that, in the meantime, we have some web api examples in the following repo.
https://github.com/EiffelNETCore/examples/tree/main/web_apis/my_first_api