Sitecore 8.1: Glass.Mapper & Razor - model-view-controller

Running a new site on Sitecore 8.1 - installed and setup Glass.Mapper but I cannot use calls such as #RenderImage - it's complaining that i'm missing the reference to Glass.Mapper.Sc.Mvc, which I have already.
The following are the Nuget modules installed for Glass.Mapper:
BoC.Glass.Mapper
BoC.Glass.Mapper.Sc
BoC.Glass.Mapper.Sc.CastleWindsor
Castle Windsor
Castle.Core
Glass.Mapper.Sc
I have it installed on another instance of Sitecore (7.5) - an older version of Glass.Mapper, but I've noticed that the Nuget packages do not exist anymore.
Any ideas?
Thanks!
Dan

BoC.Glass.Mapper is a fork of Glass Mapper, and I believe it has not been updated to V4. Remove it (and any configs that it added or deployed) and start again I say. Just add the Glass.Mapper.Sc nuget package will add in the correct dependencies and is compatible with Sitecore 8.1.
Just to be doubly sure, this is the correct version: https://www.nuget.org/packages/Glass.Mapper.Sc/
Make sure you have Sitecore.Kernel and System.Web.Mvc referenced in your project since there is a post-install step in the nuget package that adds the correct versions of Glass dlls to your project.
To make things simpler V4 uses a Powershell script to decided which
references to add to your project, it checks both the Sitecore.Kernel
version and the System.Web.Mvc version and then installs the
appropriate Glass.Mapper.Sc and Glass.Mapper.Sc.Mvc assembly.
With regards to #RenderImage, either inherit your view from GlassView<> or better to use the extension methods, e.g. #Html.Glass().RenderImage().
More info here: http://glass.lu/Blog/GlassV4

Related

Where is IApplicationBuilder.UseJwtBearerAuthentication extension in ASP.net 5?

I've seen examples that that indicate IApplicationBuilder has an extension method .UseJwtBearerAuthentication(Action<?> options).
This SO question and AspNet.Security.OpenIdConnect.Server
sample server startup file seem to say that there is such an extension. On the OpenIdConnect, I looked at the extensions folder and I don't see an extension named UseJwtBearerAuthentication. Even this blog says that it's supposed to be included with ASP.net 5. I also tried adding Microsoft.AspNet.Security.OAuthBearer, 1.0.0-beta3 to my project.json and reference it in Startup.cs. No help.
The only thing I have different is that I'm using -beta7, but I don't think that should matter.
It depends on your runtime version. In beta7 the package is called Microsoft.AspNet.Authentication.OAuthBearer, while in beta 8 the package is renamed to Microsoft.AspNet.Authentication.JwtBearer.
Since you are using beta7, add this to your project.json:
"Microsoft.AspNet.Authentication.OAuthBearer": "1.0.0-beta7"
Pro-tip: never mix beta versions like beta3 security packages and beta7 MVC packages.
In RC2, there are
Microsoft.AspNetCore.Authentication.JwtBearer
Microsoft.AspNetCore.Authentication.OAuth

Updating Xamarin app with servicestack

where is IosPclExportClient??
I used to use
PclExport.Configure(new IosPclExport());
But I have no idea what happened to IosPclExport - Now I see people are using
IosPclExportClient.Configure();
But IosPclExportClient isn't available?!
Why does all this have to change all the time?!
The official API has never changed and only has ever been IosPclExportClient:
IosPclExportClient.Configure();
The class is defined in the ServiceStack.Pcl.iOS.dll and should be added by NuGet when you add the ServiceStack.Text NuGet package. If it's not you can try removing and re-adding the NuGet package again, otherwise you can adding a manual reference to ServiceStack.Pcl.iOS.dll from your NuGet packages folder.

olingo-odata4-js project setup

I'm trying to follow the directions to setup olingo-odata4-js on a windows 8 machine.
http://olingo.apache.org/doc/javascript/project-setup.html
First Problem
After installing the main modules navigate into the folder /grunt- config/browserify_transforms/stripheader and call again npm install
But there is no such directory anywhere in the cloned repo.
Second Problem
When I open up the solution in Visual Studio, the gnuget package manager asked to restore the packages. However, the following error occurs: "unable to find version 6.0.0-beta1 of package Microsoft.Odata.Service"
Anyone successfully go through the setup? Everything looks clean and well written. I'm sure I'm just missing something.
it is a bit long story about the missing Microsoft.OData.Service 6.x, it does exist but is not officially released to public. unlike Its previous version that is for odata V3 protocol, 6.x library is for odata V4 protocol, since Microsoft OData team decided to move away from WCF Data service, and instead wanted to recommend RESTier for OData V4, so 6.x's service dll was not released.
that is why Apache Olingo doesn't make it public either. but if you need, we can provide private bits to you for running olingo-js tests (as a temp solution).

Where can I get the latest Microsoft.Exchange.WebServices.DLL?

I'm trying to use the latest Exchange Web Services DLL, however when I search my hard drive I see many versions of Microsoft.Exchange.WebServices.DLL, the most recent being version 14.0.650.7 with a date of 1/24/12.
I want to rebuild my machine but can't find an official place to get this DLL. I attempted to download the latest SDK I don't see any DLL to use, nor is there any CHM for me to use.
Where can I get the latest version of Microsoft.Exchange.WebServices.DLL?
Current version of the EWS Managed API is 1.2. It seems that Microsoft sometimes forgets to update links to the newest download which makes it hard to find out what the newest version is but I usually go to www.microsoft.com/downloads and search for "Exchange Web Services Managed API" whenever I need a fresh download.
UPDATE:
EWS is on NuGet:
http://www.nuget.org/packages?q=EWS
This is an old question, and the two answers by the OP and #JakobChristensen do answer the question. I'll just mention that I'm finding the situation fairly confusing.
I recently (manually, not via NuGet) downloaded the current NuGet version, which they currently call "2.2.0".
https://www.nuget.org/packages/Microsoft.Exchange.WebServices/
But the internal file/product version on the .dll is 15.00.0913.015.
According to this page
https://msdn.microsoft.com/en-us/library/office/dn528373(v=exchg.150).aspx
the file should be placed here:
C:\Program Files\Microsoft\Exchange\Web Services\2.0\
So that's where I placed it. Later, when playing around with a Microsoft sample program I noted that it did indeed reference the file at that location.
But another Microsoft sample program referenced the file in the GAC!
C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Exchange.WebServices\15.0.0.0__31bf3856ad364e35\Microsoft.Exchange.WebServices.dll
This version had file/product version 15.00.0847.030.
I'm not sure how that file got there, probably part of a Visual Studio installation.
There's also something called EWSCore, which is apparently a forked version of the official EWS with some bug fixes.
https://www.nuget.org/packages/EWSCore/
My current decision is that I'll consider the official NuGet version to be the version I'll standardize on, and manually download it to my development PC and my build PC and place it here:
C:\Program Files\Microsoft\Exchange\Web Services\2.0\
Options
If you use .net framework, there is a nuget package "Microsoft.Exchange.WebServices 2.2.0" here https://www.nuget.org/packages/Microsoft.Exchange.WebServices
If you use .netstandard/.net5+, you need to go the Github open source project "OfficeDev /
ews-managed-api" here https://github.com/OfficeDev/ews-managed-api , and there you download the code, and compile it. However, this project is targeting .net3.5. So, you need to convert/upgrade it to .netstandard/.net5+ manually and compile it for your self.
!! Update !!: I took the version as of date of this post from GitHub. Replaced Old Style project with SDK project. Target framework set to netstandard2.0. Added packages System.DirectoryServicesandSystem.Security.Cryptography.Xml. In files, I had to remove few namespaces that not compatible, but were not used. Removed AsImageinPhoto, this is public image retrieving method, not needed - it only converts byte array. And fixed loading issue with Assembly.GetExecutingAssembly().GetTypes();`
Type[] types;
try
{
types = Assembly.GetExecutingAssembly().GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
types = ex.Types.Where(t => t != null).ToArray();
}
I also deleted or excluded from project bunch of files related to documentation, fxcop, and assembly info.
And then it worked for sending emails with different API versions. Reading emails is not tested yet.
There is a third option. Nuget has a package "Microsoft.Exchange.WebServices.NETStandard 2.0.0-beta3" But this is not an official Microsoft code. https://www.nuget.org/packages/Microsoft.Exchange.WebServices.NETStandard/2.0.0-beta3
!! Update !!: Got this version and compared to the original code in option #2. This code has more changes than necessary to convert to .netstandard. It has some async stuff added.

Which Ninject version should I install from NuGet?

just a simple question:
I'm going to use Ninject in my ASP.NET MVC 3 application, but in the Package Manager there seem to be a few options:
Ninject
Ninject.MVC3
Ninject.Web
Among others. Which of these should I install?
See https://github.com/ninject/ninject.web.mvc/wiki/Setting-up-an-MVC3-application
http://www.planetgeek.ch/2011/03/01/ninject-2-2-1-0-and-ninject-mvc3-2-2-1-0-released/
http://www.planetgeek.ch/2011/02/22/ninject-mvc3-and-ninject-web-mvc3-merged-to-one-package/
The last one is a bit outdated in the mean time, but still contains good information. I try to update it during the comming days.
Install Ninject.MVC3. The package will automatically install any dependencies it needs (i.e. Ninject)
Edit:
Looking at Ninject.Web.Mvc.nuspec, it looks like it will install Ninject2.2.0.02.2.1.0
Placed proper version. But again, install it directly so that any dependencies are also automatically installed.

Resources