YAFLogo

AMtoUseYAF
  • AMtoUseYAF
  • 58% (Neutral)
  • YAF Forumling Topic Starter YAF Version: 4.0.0
2 months ago
There is a guide to integrate YAF.NET v4 in to an existing ASP.NET Core Application (.NET 9)

'YAF.NET Integration in to an existing ASP.NET Core Application'

https://github.com/YAFNET/YAFNET/wiki/YAF.NET-Integration-in-to-an-existing-ASP.NET-Core-Application 

But it uses the Nuget packages.

Is there a guide on how to integrate an existing ASP.NET Core Application (.NET 9) using the source code?

The problem is that want to modify some functionalities such as including verification of invitation code on registering, but I cannot do that when using nuget integration. I guess I will need to integrate with the source code.

Sponsor
Zero2Cool
  • Zero2Cool
  • 100% (Exalted)
  • YAF Leader YAF Version: YAF 3.1.16
2 months ago
That is something I was also wondering about as well. However, I think you might be able to export your own YAF flavor to Nuget.  So, you would modify the source to your liking, and then publish the package under a different name? 

ehttps://learn.microsoft.com/en-us/nuget/nuget-org/publish-a-package 

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
2 months ago
There is no need to create a nuget package. You can even use the existing yaf nuget packages, except the Razor pages. 

From the razor pages source you need the  Areas and wwwroot folder. then extra features like an invitation code for registration can be added.

AMtoUseYAF
  • AMtoUseYAF
  • 58% (Neutral)
  • YAF Forumling Topic Starter YAF Version: 4.0.0
2 months ago

That is something I was also wondering about as well. However, I think you might be able to export your own YAF flavor to Nuget.  So, you would modify the source to your liking, and then publish the package under a different name? 

ehttps://learn.microsoft.com/en-us/nuget/nuget-org/publish-a-package 

Originally Posted by: Zero2Cool 

Yes, that is possible. But why I would need that as I am not going to distribute my implementation of using YAF. It’s specific for my app. There is no point of making Nuget packages.

And even, if I do my own Nuget packages – How I am going to apply the updates for YAF Nuget Packages. 

The problems of using YAF for existing applications are:

1.) When using NUGET packages - I cannot modify the logic I functionalities

2.) When using SOURCE CODE 

a.) It will be difficult and troublesome to update YAF after I do some changes.

b.) installing and configuring YAF on existing application … And that is the reason to start this thread 

 

AMtoUseYAF
  • AMtoUseYAF
  • 58% (Neutral)
  • YAF Forumling Topic Starter YAF Version: 4.0.0
2 months ago

There is no need to create a nuget package. You can even use the existing yaf nuget packages, except the Razor pages. 

From the razor pages source you need the  Areas and wwwroot folder. then extra features like an invitation code for registration can be added.

Originally Posted by: tha_watcha 

I don’t intend to create Nuget packages, but integrating an existing ASP.NET Core Application (.NET 9) with YAF.NET v4 SOURCE CODE is not that simple as you are describing.

I have tried, but I got bogged down in all sorts of problems.

Only copying Areas and wwwroot folders is not enough. How the logic behind the Razor pages will be referenced and used?

Integrating with the existing Microsoft Membership Provider and updating the SQL database is also not trouble free.

That why I was asking for a guide on how to integrate an existing ASP.NET Core Application (.NET 9) using the source code.

Many people would love to add YAF Forums to their existing apps, but foreseeing the difficulties in integration and extending some functionalities, they give up on that idea.

@the_watcha, I understand that this is time-consuming task, but are you intending to make such a guide?

And if yes, when?

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
2 months ago
Well there is a guide that covers the basic topic of integrating the forum. 

Integrating with the existing Microsoft Membership Provider and updating the SQL database is also not trouble free

The problem is that every database is different, and it would be impossible to cover this with one guide. This would be require a custom solution for each different db.

Only copying Areas and wwwroot folders is not enough. How the logic behind the Razor pages will be referenced and used?

Well this is exactly what the razor pages nuget package does. What problems are you running in to?

AMtoUseYAF
  • AMtoUseYAF
  • 58% (Neutral)
  • YAF Forumling Topic Starter YAF Version: 4.0.0
2 months ago

Once you say (don’t use RazorPages Nuget):

“You can even use the existing yaf nuget packages, EXCEPT the Razor pages. “

and then (get/use the RazorPages Nuget) :

“Well this is exactly what the razor pages nuget package does”

So, which one?

 

In my case I prefer to get RazorPages logic from the source code. So, I can modify it if I need to.

 

“What problems are you running in to?”

Problems were too many to describe.

I have tried to add all necessary YAF source code (projects) to my app, but I couldn’t build my app any more. There always were some compilation errors.

That why I have suggested the integration guide. But probably without the installation process.

Simply - You get any ASP.NET Core Application (.NET 9) and describe which projects and folders we have to add and reference. What configurations we will need to set.

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
2 months ago

Simply - You get any ASP.NET Core Application (.NET 9) and describe which projects and folders we have to add and reference. What configurations we will need to set.

But that is described in the guide, if you use the Razor Pages Nuget Package you only need to add the YAFNET.Data.* Package, and if you dont use the Razor Pages Nuget package you need to add the YAFNET.Web nuget package (I added that to the guide)

I also added the configuration which needs to be added to the appsettings.json

AMtoUseYAF
  • AMtoUseYAF
  • 58% (Neutral)
  • YAF Forumling Topic Starter YAF Version: 4.0.0
2 months ago
For clarity let’s leave the Nuget packages aside and use only the source code.

I have tried to replicate the structure of SourceCode Solution using SqlServer.

 SourceCodeSolutionStructure.PNG You have insufficient rights to see the content.

 

Just instead of YAF-SqlStructure, I am using my own existing application.

I have moved RazorPages from Pages to Areas/Forums/Pages folder and copied everything from wwwroot. Modified Programs.cs, Startup.cs and appsettings.json files and added required references.

But it seems that I have messed up something and now I cannot compile the project.

Most likely I did something stupid, but haven’t figured out what is it yet.

That is why I asked for a guide, hoping that will help figure out what I have messed up.

Maybe solution like YAF.SampleApp(UsingNugetPackages), but YAF.SampleAppUsingSourceCode.

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
2 months ago

For clarity let’s leave the Nuget packages aside and use only the source code.

I have tried to replicate the structure of SourceCode Solution using SqlServer.

 SourceCodeSolutionStructure.PNG You have insufficient rights to see the content.

 

Just instead of YAF-SqlStructure, I am using my own existing application.

I have moved RazorPages from Pages to Areas/Forums/Pages folder and copied everything from wwwroot. Modified Programs.cs, Startup.cs and appsettings.json files and added required references.

But it seems that I have messed up something and now I cannot compile the project.

Most likely I did something stupid, but haven’t figured out what is it yet.

That is why I asked for a guide, hoping that will help figure out what I have messed up.

Maybe solution like YAF.SampleApp(UsingNugetPackages), but YAF.SampleAppUsingSourceCode.

Originally Posted by: AMtoUseYAF 

But wouldn't that be just the source, expect the forum pages in the areas folder?  Or am I missing something 

AMtoUseYAF
  • AMtoUseYAF
  • 58% (Neutral)
  • YAF Forumling Topic Starter YAF Version: 4.0.0
2 months ago
@the_watcha - Yes, on the picture is the structure of SourceCode Solution using SqlServer.

The next step is “pushing” RazorPages from Pages to Areas/Forums/Pages folder and after making few modifications I can start building main application.

( ‘Forums’ YAF RazorPages are becoming only Section/Area of the main app).

I successfully did that, but now it’s too much work to migrate my existing application into that new application (which is based on YAF Source Code App).

So, I could successfully add ‘MY EXISTING APP’ to ‘YAF SourceCode APP’,

but I could NOT add ‘YAF SourceCode APP’ to ‘MY EXISTING APP’, although I have tried to replicate the same structure, references and settings.

In theory it should have worked, but in fact I have messed it up.

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
2 months ago
Well i still dont understand why you dont wont to go the easy route and use the nuget packages. This would be easier to maintain, and you still can modify the source with Dependency injection even if you use the nuget packages.

I added a source sample as new branch to the sampleapplication project

https://github.com/YAFNET/YAF.SampleWebApplication/tree/test 

AMtoUseYAF
  • AMtoUseYAF
  • 58% (Neutral)
  • YAF Forumling Topic Starter YAF Version: 4.0.0
a month ago
@the_watcha - Sorry to be pain in the ***, but I still cannot properly integrate YAF into my existing app.

(BTW – Its MVC not RazorPages).

Finally, when I have added YAF source code I could compile my app and run my existing app.

But once I have added the following code to my Programs.cs and Startup.cs

​var host = Host.CreateDefaultBuilder(args).UseAutofacServiceProviderFactory()
            .ConfigureYafLogging()
            .ConfigureWebHostDefaults(webHostBuilder =>
                webHostBuilder.UseStartup<Startup>()).Build();

await host.RunAsync();
I run into the following error:

  ErrorPageHostArea.PNG You have insufficient rights to see the content.

So, any suggestions!

P.S. I wonder how many people have integrated their existing apps with YAF.NET v4 using the source code? Please, share your observations!  

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
a month ago
If you don't use blazor then you can delete the_host page and the blazor components in the startup.
AMtoUseYAF
  • AMtoUseYAF
  • 58% (Neutral)
  • YAF Forumling Topic Starter YAF Version: 4.0.0
a month ago
What do you mean?

First to clarify. I am not using your sample test project

https://github.com/YAFNET/YAF.SampleWebApplication/tree/test 

but the Source Code Project

https://api.github.com/repos/YAFNET/YAFNET/zipball/v4.0.0 

where I have:

“I have moved RazorPages from Pages to Areas/Forums/Pages folder and copied everything from wwwroot. Modified Programs.cs, Startup.cs and appsettings.json files and added required references.” (It worked and it’s running).

And just transfer that structure to my existing app.

So, I don’t have  _Host.cshtml page which is included in your project

https://github.com/YAFNET/YAF.SampleWebApplication/tree/test  

And I don’t understand which is this “the_host page” and what are those “blazor components in the startup”.

There are so many lines in Startup.cs that can be related to your explanation.