Can't set up asp.net mvc 2 RC and spark view engine - asp.net

Does omebody has ideas how to fix "Method not found: 'Void System.Web.Mvc.ViewContext..ctor(System.Web.Mvc.ControllerContext, System.Web.Mvc.IView, System.Web.Mvc.ViewDataDictionary, System.Web.Mvc.TempDataDictionary)'." exception. This solution doesn't work http://dotnetslackers.com/articles/aspnet/installing-the-spark-view-engine-into-asp-net-mvc-2-preview-2.aspx.
Thans for all.

I had to download the spark view engine source code (http://sparkviewengine.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27600). Once I did that I went through each of the projects that had a reference to the 1.0 version of System.Web.Mvc assembly and updated to reference to point to System.Web.Mvc 2.0. From there you can build the solution (in visual studio) and you will find that a whole bunch of tests start to fail. You can attempt to fix them (by adding the additional TextWriter parameter you will find is now needed). You will also see that the SparkView.cs file complains about a missing parameter. In the Render method (line 100 of the source code I downloaded) I had to update the instantiation of the wrappedViewContext to look like this (add writer to the end of the list of parameters):
public void Render(ViewContext viewContext, TextWriter writer)
{
var wrappedHttpContext = new HttpContextWrapper(viewContext.HttpContext, this);
var wrappedViewContext = new ViewContext(
new ControllerContext(wrappedHttpContext, viewContext.RouteData, viewContext.Controller),
viewContext.View,
viewContext.ViewData,
viewContext.TempData,
writer); // <-- add the writer to the end of the list of parameters
...
}
Once the code is updated you can run the build.cmd script that is in the root of the source you downloaded. The build process will create a zip file in the build/dist folder. Take those new dll's and add them to your website. Things should work once again.

At the time of this answer, MVC 2 RC2 bits are available at sparkviewengine.codeplex.com
http://sparkviewengine.codeplex.com/releases/view/41143
It was actually Erik from the post mentioned by R0MANARMY who helped get those bits out there.

Looks like you can also download compiled binaries from here. As the post says, it isn't a final (or official) release, but at least it seems like the unit tests pass.

Related

Cefsharp : problem with the Reqest Context of the General Usage page

I have some problems, to change user profile with cefsharp 71.0.2.
All is working good with an user1.
To change users, the General Usage Wiki page gives me the solution.
But the 3rd line of this code
var requestContextSettings = new RequestContextSettings { CachePath = cachePath2 };
browser = new ChromiumWebBrowser();
browser.RequestContext = new RequestContext(requestContextSettings, new CustomRequestContextHandler());
gives 2 errors :
impossible to convert Cefsharp.RequestContextSettings to Cefsharp.IRequestContext
CustomRequestContextHandler reference can't be found.
I used Nuget to include the package 71.0.2 targetFramework 461 to my project.
A RequestContext(requestContextSettings) constructor is working to run something, but the browser is frozen on the last page I loaded with the user1.
Some tips to fix the problem ?
I saw that a 73.1.120.pre is on GitHub, but I don't know how to manage that without some Nuget package.
Tx for your help.

.resx not working with vb code

I am making an asp.net web application with vb coding behind. I found a code online for making a multilingual website, and as the original code is in C# I made a C# project to try it. Everything went fine. Now, I converted the code to VB to use it on the original project, and for some reason, the Debugging doesn't want to start, always throwing MissingManifestResourceException as an error. The resource files' Build Action is set to Embedded Resource, and the Code I am using is this:
Dim rm As ResourceManager
Dim ci As CultureInfo
Private Sub LoadString()
Thread.CurrentThread.CurrentCulture = New CultureInfo(Session("Lang").ToString())
rm = New ResourceManager("WebApplication6.App_GlobalResources.Lang", Assembly.GetExecutingAssembly())
ci = Thread.CurrentThread.CurrentCulture
NavigationMenu.Items(0).Text = rm.GetString("MenuItemDefault", ci)
NavigationMenu.Items(1).Text = rm.GetString("MenuItemAbout", ci)
End Sub
Where "Lang" is the name of the base Resource File. The files' name:
Lang.en-US.resx, Lang.es-ES.resx
The whole error looks like this:
MissingManifestResourceException was unhandled by user code
Could not find any resources appropriate for the
specified culture or the neutral culture. Make sure
"WebApplication6.App_GlobalResources.Lang.resources" was correctly embedded or linked into
assembly "WebApplication6" at compile time, or that all the satellite
assemblies required are loadable and fully signed."
Again, in C# the whole thing worked. This code is Placed in a function, which is called from the Load_Page form.
Thanks in advance for your help!
After spending hours trying to figure out, I found a solution.
What I did was replace this string:
rm = New ResourceManager("WebApplication6.App_GlobalResources.Lang", Assembly.GetExecutingAssembly())
With this one:
rm = New ResourceManager("WebApplication6.Lang", System.Reflection.Assembly.Load("WebApplication6"))
But removing "App_GlobalResources" from the original string also worked. So the other posible solution is:
rm = New ResourceManager("WebApplication6.Language", Assembly.GetExecutingAssembly())
After replacing the string I just left everything else as it is in the main post. Now everything's working fine.

EF 4.3 Code First Migrations - Uncompress __MigrationHistory Model

How can I uncompress/read the compressed models stored in the EF 4.3 Code First Migrations __MigrationHistory table?
I found a hint in this comment, that I can uncompress it using zip/gzip, but I don't know how exactly I should do this.
The problem is that I have changed something in my ef model classes, but when I call "add-migration" an empty migration ist generated. I think that is because the changes of my model classes are already assigned to an existing migration :(
(this may be a good starting point - won't work in your case)
I think you may find this useful - you 'just' need to work it out in the opposite direction, I think (I'm just hinting here as to what might be the direction, you'll have to check it out, test yourself)...
http://brice-lambson.blogspot.com/2012/05/using-entity-framework-code-first-with.html
It uses the following code...
private byte[] GetModel(TContext context)
{
using (var memoryStream = new MemoryStream())
{
using (var gzipStream = new GZipStream(
memoryStream,
CompressionMode.Compress))
using (var xmlWriter = XmlWriter.Create(
gzipStream,
new XmlWriterSettings { Indent = true }))
{
EdmxWriter.WriteEdmx(context, xmlWriter);
}
return memoryStream.ToArray();
}
}
to serialize the model.
However, as I understand (if I understand it properly) you need it in the other direction...
Quick search didn't show the equivalent reader - you can download the latest EF6 code - or also find EF5 one (I'll link in later if needed).
Reader:
Actually this may be closer to what you want:
http://edmxdom.codeplex.com/
(I haven't tried it out but was linked from MS)
http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/1546548f-9f90-4cc2-b1b2-28cf7e9d1cb5/
And check the response about using MetadataWorkspace
If you need more info on the MetadataWorkspace I'll post some posts I made on that subject. You can get most info out - you'll need to sort 'reverse' what EdmxWriter is doing.
Essentially, you're looking for entity framework Edmx reader.
EdmxDOM:
I just checked it out fast - and it seems to be doing the Edmx format management you need.
It's a 'VB' project - but you can work through that
There is what seems to be a 'reader' (again, not sure, just went through this, as I know about the writer - but never worked w/ this part, direction)...
Public Sub LoadFile(ByVal fileName As String)
In the Edmx.vb

How to use ReportingCloud in asp.net web site?

Recently I have started to work with SSRS and found ReportingCloud. It says
ReportingCloud provides an open source quality implementation
as an extension of the RDL specification
I haven't found any tutorial/documentation on how to use it in sourceforge or via google search.
Can anyone give an walk-through/example on How to use ReportingCloud?
There is one partial example available at http://sourceforge.net/projects/reportingcloud/forums/forum/1116661/topic/4571059.
The example takes an existing RDL file, parses and executes it and then places the HTML output into an asp.net Literal Control for display in the browser.
That code snippet is repeated here:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("C:\MyFolder\MyReport.rdl");
RDLParser rdlp = new RDLParser(xmlDoc.OuterXml);
rdlp.Parse();
MemoryStreamGen ms = new MemoryStreamGen();
ProcessReport pr = new ProcessReport(rdlp.Report, ms);
pr.Run(null, OutputPresentationType.ASPHTML);
// Dump memory stream (HTML Text) to an out-of-box ASPX Literal control
this.LiteralReportHtml.Text = ms.GetText();
To do this you'll need a reference to ReportingCloud.Engine.
I'm not sure exactly what your bigger goals are but I'd like to draw your attention to another open source project on GitHub called My-FyiReporting https://github.com/majorsilence/My-FyiReporting
Just like ReportingCloud, My-FyiReporting is a fork of FyiReporting (which has gone dormant).
The big difference as far as you are concerned is that My-FyiReporting has ASP.NET samples and an ASP.NET user control link. This might be the fast way to get to what you need.
File ORIGINALPROJECT.TXT from ReportingCloud says:
The ReportingCloud is a fork from the original project fyiReporting
4.1 (http://www.fyireporting.com).
File readme.md from My-FyiReporting says:
My-FyiReporting is a fork of fyiReporting. I cannot stress this
enough. This is a FORK. The main purpose is to make sure that I have a
copy of fyiReporting since that project seems to be dead.

ASP.NET: Errors in autogenerated .Designer.cs file for Model

I'm new to ASP.NET and having a problem with a tutorial.
I've created a new MVC4 Project in VS2012 Express for Web.
And I've added a SQL Database with 1 Table "Persons" and filled it with some random testdata:
Id int (primary key, is identity=true)
name varchar(50)
birthdate date
adam 01.01.2001
berta 02.02.2002
As a Model I've used ADO.NET Entity Data Model, named it "PersonsModel.edmx"
and used the Personsdatabase for it.
To see the PersonsModel.Designer.cs file, I activated "Codegeneration Status" to "Standard". Refreshed and clicked on the PersonsModel.Designer.cs file.
But in this file I've errors... So I wanted to use something like this in my controller:
HomeController.cs:
PersonsEntities1 db = new PersonsEntities();
db.person...
but it doesn't work, and I think(?) it's because of the errors in the .Designer.cs file.
PersonsModel.Designer.cs: e.g.:
public PersonsEntities1() : base("name=PersonsEntities1", "PersonsEntities1")
{
this.ContextOptions.LazyLoadingEnabled = true;
OnContextCreated();
}
errors in the base: ... line
and in ContextOptions.
Unfortunately I've no english VS, but it says something like:
The best accordance für the overloaded System.Data.Entity.DbContext(string, System.Data.Entity.Infrastructure.DbCompiledModel)-Method has some invalid arguments
And no definition found for "ContextOptions", there is no method "ContextOptions" which accepts "MvcApplication7.Models.PersonsEntities1" as a first argument.
I'm a bit confused, because I did it like in the tutorial explained.
I think this code is in error:
base("name=PersonsEntities1", "PersonsEntities1")
There is no constructor that takes two strings. Your second argument is supposed to be of type DbCompiledModel. (See here.)
Now, I don't know why your designer would produce code that can't compile, so I'm wondering whether you have the wrong version of Entity Framework installed.
Apparently the problem was VS2012. It all works with VS2010.
I've downloaded the installer again from asp.net/mvc and added Visual Web Developer 2010 Express. After installation of VS2010 and all dependencies I tried the tutorial again and all works fine now. No wrong code in the .Designer.cs file :).
Thanks a lot Ann L. for your support. Your hint (wrong version of Entity Framework installed) prompt me to try another VS version.
In addition I've to say: I also tried VS2012 Ultimate (complete DVD version) but it didn't help.

Resources