C#/EF for Intersystems Cache - c#

My background is more in C#/.Net, and have now been offered to move to Intersystems Cache. I haven't found any recent posts on this so unless I missed something here goes:
From what I understand Cache has some mapping for ADO.NET/.NET, but is there something out there so I can use Cache for the DAL and C# for the BL/front end (like ASP.NET MVC)?
Is there a port somewhat similar to Xamarin, that allows one to write everything in C#, using Visual Studio?
I haven't started with Cache yet, but from a brief glimpse it looks somewhat similar to C# being string based and slightly similar approach to interfaces and implementation.
Thanks

Simply put: no.
However, you can use the provided DLL (InterSystems.Data.CacheClient.dll) and the reference (InterSystems.Data.CacheClient) to establish an ado connection to cache. From there you can use SQL to get your data or call a stored procedure from cache. (I'm still researching myself.)
Here's a little tutorial for a c# front-end. (a bit old though, like cache)
http://www.windowsdevcenter.com/pub/a/windows/2006/03/28/oop-c-meets-cache.html?page=1
And some documentation: (this really helped me out)
http://docs.intersystems.com/documentation/cache/20131/pdfs/GBMP.pdf
Good luck and happy coding!

Yea, this is a late response, but here's something that may help, if you're still interested.
I remember back in 2009, Intersystems came out with a .Net Gateway where the Cache developer would create a DLL for you to use to call the different routines and globals. I think that has since been kaput. So I gave up and went with a linked server (static table created by a routine's nightly build) in MS SQL.
Recent searching led me to a link to a framework which I am currently looking into. I haven't tested it yet, but it is a "LinQ API to work with Caché Globals from .NET Entity Framwork"
You may also want to take a look at Caché eXTreme and the samples provided. I'm hoping to implement one of the two (or both) in order to complete a project I'm working on.

Related

Entityspaces and Ncache

I'm sorry this is probably a borderline poor question. Does anyone have experience using write-through/read-through ncache with entityspaces?
I also tried searching for implementations of wt/rt providers for nhibernate and ncache to possibly roll my own for entityspaces, but I wasn't able to find any sample code. Is there any code that could be shared (or links) that would get me started with that?
Sorry for late reply.As per following post by EntitySpaces employee on their forum,they do not support caching to begin with.
http://www.entityspaces.net/portal/Forums/tabid/203/forumid/20/postid/5461/scope/posts/Default.aspx
However, it seems that EntitySpaces also makes use of ADO.net Provider and we do caching at ADO.net level in Entity Framework in NCache.
But we also do not provide any direct implementation/wrapper for EntitySpaces yet.

PHP to ASP.Net 4.0

I am looking for a tool that can convert a PHP application into ASP.Net application either c# or VB.Net.
I tried using the 'PHP to ASP.NET Migration Assistant' from microsoft but it leaves a lot of code un coverted and doesn't even create proper codebehind files.
Any ideas or tools that you know?
It's not going to work, sorry. Not only are the languages very different (the biggest difference arguably being that one is dynamically typed and the other is statically typed), but the entire architecture of the environment is vastly different. No automated tool is going to overcome this.
Even if you can find a tool that claims to accomplish this, it's going to emit terrible .NET code. It probably won't use any of the server controls, or at least not use any of them correctly. It's going to force the .NET code to try to do things "the PHP way" and end up costing you a ton in performance and maintainability.
Basically, there's just no way, reasonable or otherwise, to do what you're trying to do. Think of it this way... Have you ever seen automated translations between vastly different spoken languages? The results are humorous to say the least, and they are not accurate representations of the target language.
You're going to need a developer (or team of developers) to do this.
I don't think you can convert automatically a full php application into dotnet, as SLaks said, these languages are very different.
I started dotnet a half year ago, after years in php, and it's really different. You cannot use common techs from php, but you can use anothers. It's a different approach with different advantages, so an automatic tool can't do this.
Maybe you can convert some general php structures with a tool, but it won't be as good as if you write it by hand. And a complete app is nearly impossible.
For example, how would you convert a native php template based view system automatically? Maybe you can achieve this (never say impossible), but you shouldn't waste your time.
You can finish it much faster by hand than searching for a probably non-existent (or not good enough) tool.
As others have stated, an automatic converter from php to c#/asp.net is going to leave a lot to be desired.
Your question got me thinking (well, googling) about php on .net. My search found this: Welcome to Phalanger 2.x.
I don't know how mature it is (though being at 2.x implies some level of maturity); but I'm thinking that with something like this you can port your code over time, while still having the app up and running and still making incremental improvements to the application.
You can now run PHP on .NET with interop using http://phalanger.codeplex.com Some genius dun it!

Is it possible to have a connection to LotusNotes and use it as a data source for a C# project?

Is it possible to have a connection to LotusNotes and use it as a data source for a C# project?
We use LN for email/calendar. Management wants a web page that would interact with the calendar. I think this can all be done within Notes, but I would much rather do it in .NET.
Some very specific functionality is wanted, some of which I'm not really sure can even be done in Notes.
I know it's possible to interact with LN from C# because we've done it before. We had to wrap their C++ API, but it worked. Unfortunately, I don't have any code to share with you since I no longer work on that project.
I'm not certain what you mean by 'datasource', though.
Do you not have iNotes installed on your mail environment? I would look at using something that's already built instead of starting from scratch.
Have you investigated using the ODBC driver for Notes? It exposes the Notes database as if it were relational.
In my experience, it doesn't perform very well, but if your database is small enough and the transactions few enough, it may suit your purpose.

Is it possible to load and execute C# snippets using DLR?

The majority of material I have found regarding DLR is related to IronPython. Can you parse and execute C# using DLR? If so is there over head that would prevent you from attempting this on a web server with about 30 users?
More specifically I would like to script the configuration of my workflow objects when a user first initiates a workflow. Depending on conditions that change through out the year workflows may start at different steps, hence running configuration scripts seems like a good way to handle the variation.
It sounds like you're really talking about the C# "compiler as a service" (at the end of this video), which will hopefully be in the 5.0 timescale for .NET (although Mono has it now). For now, CSharpCodeProvider is the best we have (which works largely like "csc").
Although Marc offered an alternative for me, I read this related SO question and C# and VB are not supported as of yet.
You may find this relevant...though it doesn't run on the DLR itself.
Mono Compiler as a Service (MCS)
It has the advantage of running snippets and not loading a new assembly on every compile like CodeDom does.

NHibernate Code Generation

I am working with NHibernate, and a few code generation tools. MyGeneration is one and SmartCode is the other.
This question has been asked before, but I have looked at some other responses and found that the code generation tools in the nHibernate space to be pretty poor.
I might be able to get away with MyGeneration and SmartCode, but are there any other possibilities out there that you have specifically used, and would recommend?
I guess my criteria is that they must work with MSSQL 2008, and tools that are currently being developed would be good too as it seems that some of the tools are not being actively developed any more.
Also the tools would ideally generate the domain objects, and also the nhibernate mapping files - Fluent nhibernate would be good but not essential. It would be good if the templates and method of code generation could be tweaked.
I am a developer so am happy to get my hands dirty on the right tool to make changes.
Thanks.
I strongly recommend you take a look at Visual NHibernate
from Slyce. I have used all tools out there both free and commercial and found it to be the only one that does exactly what it says on the can and more.
It allows you to design your entities either from the ground up or from an existing database.
(source: slyce.com)
It is compatible with most existing dbs
with future suport for Postgresql.
It allows you to customise your entities to your specs
(source: slyce.com)
Other than its ability to go back and forth smoothly between entities and db during design, my most favorate feature is the Diff View
(source: slyce.com)
which shows changes it will make to code before it generates the code. So not only can you see the effect of your changes but you can also cancel the codegeneration in time or simply output to a different folder.
This tool has many many fine features and is now mature. Lastly, there is a 30% discount going on so ;-)
I was using Adapdev's Cudus in the past and now I'm using NConstruct (http://www.nconstruct.com) because I need also application generation, not just NHibernate mapping files.
It doesn't support SQL 2008 and I've contacted them about this issue because I also plan to migrate from SQL 2005 to SQL 2008 in the near future. According to their response newer versions will support it but I don't know when. Maybe more of us need to push them to get SQL 2008 sooner. Otherwise I like this tool very much.
I suggest taking a look at the Summer of Nhibernate series by Steve Bohlen, specifically Session 8 which talks about using NHibernate with a a pre-existing/legacy datastore situation. He uses MyGeneration and provides the template file he uses for doing so.
I've used CodeSmith and been very happy with it. I haven't used their NHibernate template but I know it is just one of the many frameworks they support. Have a look here.
You may want to keep an eye on ABSE (http://www.abse.info). ABSE is a code-generation and model-driven software development methodology that is completely agnostic in terms of platform and language, so you wouldn't have any trouble creating your own generators for NHibernate, MSSQL 2008 and anything else you wish. The big plus is that you can generate code exactly the way you want. The downside is that you may have more work to do at first to build your templates.
Unfortunately, ABSE is still work in progress and an Integrated Development Environment (named AtomWeaver) is still in the making. Anyway a CTP release of the generator is scheduled for January 2010, so we're already close to it.
The NHContrib project includes a tool called hbm2net to generate code. I've never used it, so I've no idea what sort of code it produces, but I know it uses NVelocity. Link to a tutorial.

Categories

Resources