KalikoCMS / KalikoCMS.Core

Open source content management system (CMS) for the ASP.NET platform.
GNU Lesser General Public License v3.0
145 stars 64 forks source link

.NET 5 / ASP.NET MVC 6 support? #58

Open dotnetshadow opened 8 years ago

dotnetshadow commented 8 years ago

Hi I was wondering if you will have support for .NET 5 / ASP.NET MVC 6 support?

fschultz commented 8 years ago

Yes, there will most likely be an ASP.NET 5 version of the project. When in time I can't say at the moment. I suspect most of the work will be to around the HTTP request pipe which needs to be rewritten (since the current version heavily relies on HTTP modules).

I'm currently working on version 1.1.0, but after it's done I will start to look at how much work it would require to also support ASP.NET 5.

dotnetshadow commented 8 years ago

Great to hear,

Yes ASP.NET 5 version would be greatly appreciated especially with the roadmap pointing to very near future release (Nov for RC1).

Currently developing an ASP.NET MVC 6 app but I have no way of integrating this Kaliko CMS. For now I've set up dummy ASP.NET MVC 5 app so that I can at least use the backend to start storing some information.

If there was a way to get the HttpModule side of things working that would be great.

Thanks for your time

dotnetshadow commented 8 years ago

Just wanted to give you an update that ASP.NET 5 RC1 is out with a Go Live license meaning there shouldn't be any further changes to the Framework.

Hopefully have your 1.1.0 release you can have an option to integrate Kaliko into an ASP.NET 5 MVC 6 application.

dotnetshadow commented 8 years ago

Hi there I just wanted to give you a heads up that ASP.NET Core RC2 should be released next week so hopefully some in roads can be made.

fschultz commented 8 years ago

Thanks for the heads up! I've given the ASP.NET 5 conversion another go since last time, but unfortunately it's like a snow ball going down-hill with each time finding a new problem area (currently the change in HttpContext). I'm starting to think that maybe the "easier" approach would be to rewrite it from scratch.

dotnetshadow commented 8 years ago

I know what you mean with rewriting, I've been finding a few issues too with my work. Do you have an ASP.NET core branch? or something I could possibly look at?

fschultz commented 8 years ago

I've uploaded an archive if you want to take a look, thanks! https://dl.dropboxusercontent.com/u/5437987/DemoSite.vNext20160515.zip

dotnetshadow commented 7 years ago

Hi there it's been a while, was distracted with other projects but I'm looking to getting onto this again... just saw an interesting post that could help with this issue a little http://benfoster.io/blog/net-core-configuration-legacy-projects

Has there been any progress on this?

fschultz commented 7 years ago

Hi, thanks for the link! There's so much that needs to be rewritten including the complete data layer that needs to be converted from Telerik Data Access to EF Core, so I think the proper approach would be to rewrite it from the ground up and in the same time make it more service oriented. I also have some ideas when it comes to editing to really push it into the next gen of CMS:es. But at the moment time is very limited.

dotnetshadow commented 7 years ago

That's pretty cool, yes I'm having time constraints too unfortunately.

Maybe an idea for the first step to bridge the gap between the old and new version would be to have at least the content being able to be read into any other app, either via web api or some means.

So the backend could stay as WebForms for the time being, but provide a mechanism by which content can be read from the datastore through a method such as GetContentForCurrentUrl()

I could probably have a go at this too, but I guess I probably don't understand how data is stored and related to each other

dotnetshadow commented 7 years ago

Hi there, I was wondering if there has been any progress with .net core?

I have my content currently in the old asp.net version and I'm trying to now get it in asp.net core. Is a there a quick and dirty way to at least read the content of a page from the database?

I know you said you wanted to rewrite the project but I'm guessing that would take quite a while, and I just need some sort of solution to get up and running.

fschultz commented 7 years ago

Unfortunately I haven't had time to take this forward. Your idea of doing in steps is good, but the first step is a pretty big one.

If I recall correctly I have a new middle-ware that will replace the routing, but everything else in the KalikoCMS.Engine project must be ported. The main thing to do is to port all the Telerik Data Access code over to Entity Framework Core since Data Access won't compile for core (which I believe is due to manipulation at compile time of the binaries).

Once the data layer is converted the remaining job is to hunt down all dependencies that are not compatible with .net core and replace them with code that is.

dotnetshadow commented 7 years ago

Thanks for getting back to me

That's right, I think you started something in the dnx days, just wondering if you had anything since .net core got released?

Do you currently have a time frame in mind? I would need to make a decision by end of Feb. I really liked using Kaliko and it fit well but the project I'm building needs to be completed very soon so I'm not sure what I can do to get at least the "Article Pages" appearing in my web application

fschultz commented 7 years ago

I can't make any promises as I currently have much of my time tied up in the launch of a startup, but if you're able to help with some of the conversion I could make the initial porting to the data layer to get things going?

dotnetshadow commented 7 years ago

Yeah I might be able to help out and see what I can do.

What in particular would you like me to look at?

dotnetshadow commented 7 years ago

Just for your info: http://www.telerik.com/data-access-sunsetting

Also preview of .NET Core 2.0 is out which has a lot more of the APIs that were missing before in .NET Core 1.0 so it may help with this issue?

fschultz commented 7 years ago

Thanks for the heads-up! I saw this a while ago and after giving a complete rewrite a go earlier this year I realized that I need to do this in steps. The first step will be to start by replacing the data layer with Entity Framework Core and then gradually starting to make the code Core-compatible. I will start this work after I've released the pending 1.2.1 version, which most likely will be this week.

It may be a while before the official package is available for .NET Core, but my aim is to try to get the project compatible as soon as possible. I already have a MVC-provider that works with the new middleware pipeline and will be adding it to the core-branch that I'll create after the 1.2.1 release.

dotnetshadow commented 7 years ago

@fschultz that is great news. Looking forward to seeing the .net core stuff.

I'm wondering if I have an existing standard .net core site do you think that KailkoCMS would be able to just be plugged in? I remember with the older version you had your own identity etc. I was thinking for at least the rending of the pages (not the backend) that there could be a way to define a section to be used that could inherit my layout etc.

Basically I would like to use KalikoCMS just for say my Articles section of the site without having to modify much to my existing site if that makes sense

fschultz commented 7 years ago

Yes, the same idea applies as the current version has; it should be modular and not interfere with routing etc to other parts of the solution. The next version will have a module for ASP.NET Identity, but you might as well use a custom authentication scheme such as Active Directory: http://kaliko.com/cms/knowledge-base/use-with-owin-and-active-directory/

There should be no problem using the CMS only for a part of a website. The admin UI will take the longest to convert since it's WebForms-based today, but meanwhile it will be possible to create a custom admin using page publishing functions to make changes.

dotnetshadow commented 7 years ago

Excellent that's what I wanted to hear.

As I said earlier currently we have all our content in the MVC5 version and yes the backend that you use is webforms which is fine for content editing.

Now I have an asp.net core application and would love to leverage the module to be able to just see the content in a site. So from what you said it looks like that will be possible without having to modify much on my asp.net core site.

dotnetshadow commented 6 years ago

Hi there has the core branch been made available yet?

Also with .net core 2.0 there is a new Razor Pages feature which might make things a little easier different way of thinking

fschultz commented 6 years ago

Hi, I apologize for the very slow progress. After the release of version 1.2.1/1.2.2 that is out now I'll be splitting development in two branches; 1.2.3 will be bug fixes for 1.2.2 and 1.3.0 that will contain the data layer replaced by Entity Framework Core as well as a more service oriented approach opening up for replacing parts like the configuration with a custom implementation.

dotnetshadow commented 6 years ago

Nice work, can't wait to start playing around with the 1.3.0 branch, desperately need this now

bbqchickenrobot commented 6 years ago

Can't find the 1.3.0 branch.... is it up yet? Also, would love to help converting this to .net core. Which I believe does not support WebForms any longer so the admin interface will have to be converted as well. Let me know if and where I can be off assistance =)

fschultz commented 6 years ago

I thought that I had published my local branch when I set it up, but it seems like I failed to do that.

I would really appreciate any help I can get to make the CMS ASP.NET Core compatible, thanks :) It has been a bit of a bad conscience since I haven't had the time needed to take this forward in the speed that I would like to.

The initial goal is to have the 1.3.0 branch up and running using EF Core as the data layer instead of Telerik Data Access. After that starting to introduce interfaces and services in order to prepare some of the parts for conversion and finally branch off to a new ASP.NET Core branch in order to convert the projects and replace all code not compatible with ASP.NET Core. This last step will be the major one, especially creating a new admin interface after getting the website up and running under ASP.NET Core (which is the primary goal), since as you write all WebForms need to be replaced. All help would be very appreciated!

Development will be a bit slow during vacation time, but will hopefully speed up in a week or two. I've ported the data entities and will continue finishing the EF Core implementation before making the first commit (and this time remember to properly publish the 1.3.0 branch).

I'll post a status update in this thread once the initial commit is done.

bbqchickenrobot commented 6 years ago

Sounds good! What about using nosql in addition to sql? I think this would require using a repository type pattern (interface). Then it would be possible to use any database as the backend as long as the data access but we're coded using the repository interface.... Just a thought

dotnetshadow commented 6 years ago

@fschultz @bbqchickenrobot Great work guys, happy to see that there will be progress on this, not many good .net core cms systems out there and this would be a great addition.

I would like to see the direction that I would be able to just implement it into an existing .net core application without having to use the kaliko authorization/authentication stuff, or anything else. I think we have spoken about this in the past and agreed that a service oriented system where you can just make calls to cms parts would be great.

bbqchickenrobot commented 6 years ago

@fschultz - @dotnetshadow - What do you think about using Serilog for logging?

dotnetshadow commented 6 years ago

@bbqchickenrobot I've had limited use of it in the past it's pretty good

kalikocom commented 6 years ago

It's an interesting idea to allow overriding the data layer by exposing a repository interface. It falls very well in line with the service oriented structure I'll introduce to solve some of the issues facing the migration as well as modernizing the code. I will make it part of the new data layer.

As with the current version, things like security will continue to be modular and optional.

I'll check out Serilog. The current custom logger used is overdue a replacement.

Thanks for the suggestion!

dotnetshadow commented 6 years ago

Great work guys it sounds very promising.

Don't want to put any pressure, but is there a loose time estimate you are hoping to get things done by? Like what are you hoping to achieve in 3months? 6months? 12 months?

Perhaps a milestone thing could be good to have, just trying to gauge when I could start using it

fschultz commented 6 years ago

I really wish I could give a good estimate. But since this project is done in my spare-time the time I can spend is very much limited by work and other obligations in life.

That said, in 3 months I hope to have the new Entity Framework code in place and hopefully migrated some of the base code to an ASP.NET Core compatible solution. A fully working system complete with a new administration interface is further away than that, but hopefully it will at least be a good start on the journey and give an indication of the road left.

I'll update this thread with the progress.

bbqchickenrobot commented 6 years ago

Looks like .net core 2.0 (released today) can aid the transition by allowing previous versions of .net (4.5.1, etc) to run within .net core. This could greatly ease the transition allowing kaliko to implement core features over time!

As for the data repository I propose SharpRepository - it heavily implements the repository pattern and has several data stores it can make use of. It also allows to easily add other data stores.

fschultz commented 6 years ago

SharpRepository seems interesting, I'll check it out, thanks! Starting to add a repository pattern is probably one of the next steps in the 1.3.0 version as I've replaced the entities in my local test branch with ones based Entity Framework Core. There's a bit of mapping left to do and also to rewire some logic, but the next step will be to get it up and running somewhat and then start forming the repository layer.

PonchoPowers commented 6 years ago

I know this has been pretty much a two-way conversation at the moment but I'm an active contributor of .NET Core and in my view you would be looking at a complete rewrite. The beauty of this project is how it combines a CMS and the MVC pattern and that should be the focus if you embark on rewriting this project.

fschultz commented 6 years ago

Thanks for the input! I suspect that in the end it will be somewhat of a complete rewrite. But it's a daunting task and my initial approach will be to replace parts step by step. At some point (most likely when the new MVC-based admin interface is implemented) there will be a larger step in a new direction.

dotnetshadow commented 6 years ago

Hi guys, has there been any further work been done on this? Any preview bits?

fschultz commented 6 years ago

I wish I would have some better news but the progress is a bit slow. At the moment I've rewritten the data layer to EF Core but I fail to get it working towards an existing database, so I seem to have some mapping left to get right. Once I do I'll publish an experimental-branch here as I continue with the conversion. The middleware for handling the routing in .NET Core is somewhat ready, but needs to be tested properly once I get the data layer working fully. Hope to have more information soon.

dotnetshadow commented 6 years ago

@fschultz good work, it's progress none the less :)

I would be happy to take a look at what you currently have and do some testing on it?

dotnetshadow commented 6 years ago

Any luck with having an experimental branch? Is there a way you can send me a zip file or something?

fschultz commented 6 years ago

I've put some effort into solving some of the issues this weekend and published the experimental-branch here: https://github.com/KalikoCMS/KalikoCMS.Core/tree/experimental

There's a few issues still in the data layer (tags and data store entities not working fully), but Telerik DataAccess has been replaced by Entity Framework Core 1.x.

You'll need to convert some of the database fields to bits and you'll find the script for doing that in ReleaseNotes.md

The plan is to replace all parts not compatible with .NET Core and port the project over. The long term goal is to do a rewrite and provide a migration tool for old projects.

dotnetshadow commented 6 years ago

Thank you so much appreciate it, I'll take a look and see if there as any issues 👍

I noticed you said you converted to Entity Framework Core 1.x is there a reason not to use Entity Framework 2.x? There is a heap of improvements in the latter version

fschultz commented 6 years ago

I had some problem getting EF Core 2.x working with 4.6.x, but it seems that it was my Visual Studio / NuGet package manager that caused that, will update to the latest.

Glad to have a bit of progress to report. I've set up a new repository (https://github.com/KalikoCMS/KalikoCMS.NextGen/tree/develop) that will be the version 2.0 and be fully compatible with both 4.6.x and .NET Standard 2.0/.NET Core 2.0.

The main reason I've created a new repository is to also be able to do some changes to the core I've wanted to do a long time. For compatibility with the current version of the CMS I'll add an export/import function to help upgrading existing websites.

The repository currently consist of some of the infrastructure needed as well as a project structure setup for both 4.6 and .NET Standard 2.0.

Logging The choice of logger should be made by the developer using the CMS, so the old Logger is replaced by LibLog - a logging abstraction library that works with Serilog, log4net, NLog and more.

Dependency injection To make the system more mod-able and allow developers to write more modern code a dependency injection framework is added. As with logging this will be made agnostic so that a developer can switch to the DI-framework of their choice, but a implementation using SimpleInjector will be available.

More content types The current version only has two types of content; page types and site settings. A new content type; block, will be added in version 2.0 that will introduce reusable elements. Blocks will also replace the composite property.

Improved MVC support Together with blocks, partial rending of pages will be available through partial views and properties will support @Html.DisplayFor. This will offer great possibilities for context aware rendering in for instance lists of items.

New proxy for typed pages As RealProxy isn't available in .NET Core the proxy system used to expose page properties through a strongly typed model is being changed to Castle Core's Dynamic Proxy. A limitation in the current version is that pages from functions returning lists need to be explicitly casted, making casting towards interfaces a bit hard. In 2.0 the lists will carry typed versions.

Better packaging Current version adds all files for the admin-area as files in the project, 2.0 will embed these resources reducing number of files on the websites.

The roadmap currently look something like this:

fschultz commented 6 years ago

Also property types will be retiring in 2.0 in favor of datatypes and classes, for instance instead of a StringProperty, a string could be used in the model. Making content types more like standard classes to work with. Conversion of this will be made available as a part of the import/export tool.

fschultz commented 6 years ago

Almost forgot some of the main benefits of rebuilding the core based on the original code rather than just porting; making small changes to be able to provide support for multi-language, multi-site and access rights.

dotnetshadow commented 6 years ago

Wow fantastic progress, this has come at a timely manner. This seems really exciting, I can understand this is a massive task, I have to ask the dreaded question, when could we expect something usable?

Current Situation For my personal needs right now I have the following scenario:

The issue for me right now is that Kaliko CMS v1.x used HTTP handlers and modules to route / display pages. ASP.NET Core uses middleware instead.

Would it be difficult just to provide a very basic version of middleware or something so that I can just use it in a controller / page to get my articles displayed?

fschultz commented 6 years ago

What makes it hard to say is the uncertainty in getting things like the routing parts working fully in ASP.NET Core.

I'm currently working on the middleware (did a work-in-progress commit to the new repository) but am stuck on how to execute the proper controller from the intercepted request. In ASP.NET 4.x it was possible to execute a specific action in a controller by doing (code from KalikoCMS.Mvc.RequestModule):

            var requestContext = new RequestContext(new HttpContextWrapper(httpContext), routeData);
            ((IController)controller).Execute(requestContext);
            httpContext.ApplicationInstance.CompleteRequest();

This doesn't seem quite as easy in ASP.NET Core. Any input on the subject would be much appreciated.

fschultz commented 6 years ago

I had to change approach, it seems the best way is to implement IRouter and invoke the action myself in the router instead of a previous step. It makes sense and it's actually neater than in ASP.NET 4.x where I had to add router constraints in order to fire the router at the right time in the request pipe.

dotnetshadow commented 6 years ago

Ahh nice, I'll check this out over the weekend and see if I can get a sample going

fschultz commented 6 years ago

A quick update on progress; The new data model is pretty much in place and I'm currently working on the initialization routines (synchronization of content types and properties between code and database). Next step is to load up the index with the site content and after that finish the routing, pretty large tasks but currently it's progressing pretty well.