In ServiceStack is there an implementation of HttpError?
I can find the interface definition:
namespace ServiceStack.ServiceHost
{
public interface IHttpError : IHttpResult, IHasOptions
{
string ErrorCode { get; }
string Message { get; }
}
}
But am I missing a using directive, because I get this compiler error:
The type or namespace name 'HttpError' could not be found (are you missing a using directive or an assembly reference?)
The HttpError class is in the ServiceStack.Common.Web namespace (ServiceStack.Common assembly/NuGet package) in the current (version 3) release of ServiceStack.
In under-development version 4, looks like it was moved to the root ServiceStack namespace.
I just found out how to search namespaces, in VS2012 anyway... Select the class and type Shift-Alt-F10... this causes a little dropdown box to appear... click on it and you will see the namespaces that have matching class names!
Related
I'm needing to adjust some of the field attributes for the Location.VCashAccountID field on the Vendors screen - AP303000. When I put the code below into a customization DLL, it compiles fine and there are not apparent issues on the screen. However, when I try to publish the customization project with the DLL included, I get an error.
Code:
public class VendorMaintDefLocationExtExt : PXGraphExtension<VendorMaint.DefLocationExt,
VendorMaint>
{
public void _(Events.CacheAttached<PX.Objects.CR.Standalone.Location.vCashAccountID> e) { }
}
Error:
"Method Boolean DoValidateAddresses(PX.Objects.CR.Extensions.ValidateAddressesDelegate) in graph extension is marked as [PXOverride], but the original method with such name has not been found in PXGraph"
What am I missing?
TIA!
The following implementation will override the vCashAccount attribute on AP303000
public class AAVendorMaintDefLocationExtExtension : PXGraphExtension<DefLocationExt, DefContactAddressExt, VendorMaint>
{
[PXMergeAttributes(Method = MergeMethod.Merge)]
[PXUIField(DisplayName = "I am override")]
public void _(Events.CacheAttached<PX.Objects.CR.Standalone.Location.vCashAccountID> e) { }
}
You will also require the following references
using PX.Data;
using PX.Objects.AP;
using static PX.Objects.AP.VendorMaint;
The result can be seen in the snip below
The main difficulty in this task was the multitude of graph extensions utilized by the page. Though it's a beneficial design to encapsulate functionality it can be finnicky to determine which order they should be declared in a new extension.
You're graph extension extends VendorMaint.DefLocationExt which contains DoValidateAddresses. Try just extending VendorMaint.
I have been trying to create a automapper Custom value resolvers, but I seem to have missed some set up step as it can never seem to find
public abstract class ValueResolver<TSource, TDestination> : IValueResolver
So in the following snippet will not compile.
using DITest.Models; // This is where the SalesOrder class is
using AutoMapper;
namespace DITest.AutoMapper.SaleOrder
{
public class FullAddress : ValueResolver<SalesOrder, string>
{
protected override string ResolveCore(SalesOrder source)
{
return "foo bar";
}
}
}
I get the error message
The type or namespace name 'ValueResolver<,>' could not be found (are you missing a using directive or an assembly reference?)
Its say the using AutoMapper is not used.
In the past I have been naughty and hacked in a reference for lib\net45\AutoMapper.dll
Please try IMemberValueResolver type instead of IValueResolver. The AutoMapper had some upgraded things.
https://github.com/AutoMapper/AutoMapper/wiki/5.0-Upgrade-Guide
ValueResolver is gone. IValueResolver is the replacement. And there is also IMemberValueResolver, as the docs say.
I'm having some trouble with an Helper/Extension class I made. When trying to use it in my razor view I get
Compiler Error CS0234. The type or namespace name 'name' does not exist in the namespace 'namespace' (are you missing an assembly reference?)
I have a MVC 5 web project where I have a class library (which works as an addon) containing my UI controllers and views. The view was rendering and my controller action is executing.
When I do #using my_project.UI.Navigation, I get compiler error CS0234. Later in my view I have a call to #NavigationHelper.BuildHtml() (which full is in my_project.UI.Navigation).
But my controller can execute just fine:
#using my_project.UI.Navigation
namespace my_project.Controllers
{
public UiController : IController
{
public ActionResult Index()
{
var test = NavigationHelper.BuildHtml();
return View();
}
}
}
both classes and namespaces are in the same assembly.
I am a newbie to visual studio so apologies in advance for anything dumb I ask or say.
I am trying to inject a username and password into a document and automatically sign in to a https web site.
I use the code as follows:
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using System.Windows.Forms;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using TasKey2.Resources;
using System.IO.IsolatedStorage;
namespace myapp
{
public partial class MainPage : PhoneApplicationPage
{
bool isLoggedOn = true;
private string splashScreen = "https://xxxxxxt";
private string teamScreen = "https://xxxxxxx";
private string mainUrl;
private string username, password;
private bool loggedOn;
System.Windows.Forms.WebBrowser webBrowser;
......
private void Browser_Loaded(object sender, RoutedEventArgs e)
{
Browser.IsScriptEnabled = true;
if (isLoggedOn)
{
mainUrl = teamScreen;
Browser.Navigate(new Uri(mainUrl, UriKind.Absolute));
HtmlElement userName = webBrowser.Document.GetElementById("Login1_UserName");
userName.SetAttribute("value", username);
userName.RemoveFocus();
HtmlElement passWord = webBrowser.Document.GetElementById("Login1_Passwrod");
passWord.SetAttribute("value", password);
HtmlElement logonForm = webBrowser.Document.GetElementById("Login1_LoginButton");
logonForm.InvokeMember("click");
}
When I do I get the following error:
Error 1 The type or namespace name 'Forms' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)
Error 2 The type or namespace name 'Forms' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)
Error 3 The type or namespace name 'NavigateEventHandler' could not be found (are you missing a using directive or an assembly reference?)
SO I go to the Object Browser and can add System.Windows.Forms v2 and v4
Regardless of which one I addd I now get the following error:
Error 2 The base class or interface 'System.ComponentModel.Component' in assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' referenced by type 'System.Windows.Forms.Control' could not be resolved c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Windows.Forms.dll
I am banging my head against a bring wall on this. How do I add the System.Windows.Forms to my code and make it work?
I am working on MonoTouch binding of an Objective-C application. I referred iOS Binding Walkthrough.
I have generated libraries for i386, ARM and then a universal library. Further, I created a MonoTouch Binding Project. I have generated ApiDefinition using Sharpie and added the universal library generated earlier. Now when I build this project I am getting the following error.
ADClusterAnnotation.g.cs(86,86): Error CS0533: AnnotationClusterMap.ADClusterAnnotation.Coordinate' hides inherited abstract member MonoTouch.MapKit.MKAnnotation.Coordinate' (CS0533)
Here is the code snippet of ADClusterAnnotation:
File ADClusterannotation.h
#interface ADClusterAnnotation : NSObject <MKAnnotation> {
CLLocationCoordinate2D _coordinates;
}
#property (nonatomic) CLLocationCoordinate2D coordinate;
#end
File ADClusterAnnotation.m
#synthesize coordinate = _coordinates;
Here is the code snippet from ApiDefinition
[BaseType (typeof (MKAnnotation))]
public partial interface ADClusterAnnotation {
[Export ("coordinate")]
CLLocationCoordinate2D Coordinate { get; set; }
}
So I think we need to change something in ApiDefinition. I tried removing Coordinate from ADClusterAnnotation in the API definition, but then it gives an error that it implements an abstract member. What am I missing with regard to Monotouch binding?
Overriding an abstract member require c# new or override
You can get that to be generated by changing your ApiDefinition to:
[BaseType (typeof (MKAnnotation))]
public partial interface ADClusterAnnotation {
[Export ("coordinate")]
[New]
CLLocationCoordinate2D Coordinate { get; set; }
}