Search Results

Search found 14402 results on 577 pages for 'interface builder'.

Page 7/577 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Use interface between model and view in ASP.NET MVC

    - by Icerman
    Hi, I am using asp.net MVC 2 to develop a site. IUser is used to be the interface between model and view for better separation of concern. However, things turn to a little messy here. In the controller that handles user sign on: I have the following: IUserBll userBll = new UserBll(); IUser newUser = new User(); newUser.Username = answers[0].ToString(); newUser.Email = answers[1].ToString(); userBll.AddUser(newUser); The User class is defined in web project as a concrete class implementing IUser. There is a similar class in DAL implementing the same interface and used to persist data. However, when the userBll.AddUser is called, the newUser of type User can't be casted to the DAL User class even though both Users class implementing the interface (InvalidCastException). Using conversion operators maybe an option, but it will make the dependency between DAL and web which is against the initial goal of using interface. Any suggestions?

    Read the article

  • C# Interface Method calls from a controller

    - by ArjaaAine
    I was just working on some application architecture and this may sound like a stupid question but please explain to me how the following works: Interface: public interface IMatterDAL { IEnumerable<Matter> GetMattersByCode(string input); IEnumerable<Matter> GetMattersBySearch(string input); } Class: public class MatterDAL : IMatterDAL { private readonly Database _db; public MatterDAL(Database db) { _db = db; LoadAll(); //Private Method } public virtual IEnumerable<Matter> GetMattersBySearch(string input) { //CODE return result; } public virtual IEnumerable<Matter> GetMattersByCode(string input) { //CODE return results; } Controller: public class MatterController : ApiController { private readonly IMatterDAL _publishedData; public MatterController(IMatterDAL publishedData) { _publishedData = publishedData; } [ValidateInput(false)] public JsonResult SearchByCode(string id) { var searchText = id; //better name for this var results = _publishedData.GetMattersBySearch(searchText).Select( matter => new { MatterCode = matter.Code, MatterName = matter.Name, matter.ClientCode, matter.ClientName }); return Json(results); } This works, when I call my controller method from jquery and step into it, the call to the _publishedData method, goes into the class MatterDAL. I want to know how does my controller know to go to the MatterDAL implementation of the Interface IMatterDAL. What if I have another class called MatterDAL2 which is based on the interface. How will my controller know then to call the right method? I am sorry if this is a stupid question, this is baffling me.

    Read the article

  • implementing the generic interface

    - by user845405
    Could any one help me on implementing the generic interface for this class. I want to be able to use the below Cache class methods through an interface. Thank you for the help!. public class CacheStore { private Dictionary<string, object> _cache; private object _sync; public CacheStore() { _cache = new Dictionary<string, object>(); _sync = new object(); } public bool Exists<T>(string key) where T : class { Type type = typeof(T); lock (_sync) { return _cache.ContainsKey(type.Name + key); } } public bool Exists<T>() where T : class { Type type = typeof(T); lock (_sync) { return _cache.ContainsKey(type.Name); } } public T Get<T>(string key) where T : class { Type type = typeof(T); lock (_sync) { if (_cache.ContainsKey(key + type.Name) == false) throw new ApplicationException(String.Format("An object with key '{0}' does not exists", key)); lock (_sync) { return (T)_cache[key + type.Name]; } } } public void Add<T>(string key, T value) { Type type = typeof(T); if (value.GetType() != type) throw new ApplicationException(String.Format("The type of value passed to cache {0} does not match the cache type {1} for key {2}", value.GetType().FullName, type.FullName, key)); lock (_sync) { if (_cache.ContainsKey(key + type.Name)) throw new ApplicationException(String.Format("An object with key '{0}' already exists", key)); lock (_sync) { _cache.Add(key + type.Name, value); } } } } Could any one help me on implementing the generic interface for this class. I want to be able to use the below Cache class methods through an interface.

    Read the article

  • Flash Builder missing fundamental things

    - by Bart van Heukelom
    All of a sudden Flash Builder 4 is missing all kinds of fundamental things and is generating incorrect errors. I've had the same issue yesterday, where I fixed it by downloading a new Flex SDK and importing that into FB. I did this again, but this time it fixed nothing. I don't think it's something I did, like removing critical references from the build path. The errors also appeared on projects I was not working on at the time. It occurs for ActionScript, Flex and Flex Library projects alike. Update: I find this stack trace in the Flash Builder error log: !ENTRY com.adobe.flexbuilder.project 4 43 2010-05-11 11:55:47.495 !MESSAGE Uncaught exception in compiler !STACK 0 java.lang.NullPointerException at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2592) at macromedia.asc.parser.VariableBindingNode.evaluate(VariableBindingNode.java:64) at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2233) at macromedia.asc.parser.ListNode.evaluate(ListNode.java:44) at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2578) at macromedia.asc.parser.VariableDefinitionNode.evaluate(VariableDefinitionNode.java:48) at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2310) at macromedia.asc.parser.StatementListNode.evaluate(StatementListNode.java:60) at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2503) at macromedia.asc.parser.WithStatementNode.evaluate(WithStatementNode.java:44) at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2310) at macromedia.asc.parser.StatementListNode.evaluate(StatementListNode.java:60) at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2891) at macromedia.asc.parser.FunctionCommonNode.evaluate(FunctionCommonNode.java:106) at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2905) at macromedia.asc.parser.FunctionCommonNode.evaluate(FunctionCommonNode.java:106) at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:3643) at macromedia.asc.parser.ClassDefinitionNode.evaluate(ClassDefinitionNode.java:106) at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:3371) at macromedia.asc.parser.ProgramNode.evaluate(ProgramNode.java:80) at flex2.compiler.as3.As3Compiler.analyze4(As3Compiler.java:709) at flex2.compiler.CompilerAPI.analyze(CompilerAPI.java:3089) at flex2.compiler.CompilerAPI.analyze(CompilerAPI.java:2977) at flex2.compiler.CompilerAPI.batch2(CompilerAPI.java:528) at flex2.compiler.CompilerAPI.batch(CompilerAPI.java:1274) at flex2.compiler.CompilerAPI.compile(CompilerAPI.java:1496) at flex2.tools.oem.Application.compile(Application.java:1188) at flex2.tools.oem.Application.recompile(Application.java:1133) at flex2.tools.oem.Application.compile(Application.java:819) at flex2.tools.flexbuilder.BuilderApplication.compile(BuilderApplication.java:344) at com.adobe.flexbuilder.multisdk.compiler.internal.ASApplicationBuilder$MyBuilder.mybuild(ASApplicationBuilder.java:276) at com.adobe.flexbuilder.multisdk.compiler.internal.ASApplicationBuilder.build(ASApplicationBuilder.java:127) at com.adobe.flexbuilder.multisdk.compiler.internal.ASBuilder.build(ASBuilder.java:190) at com.adobe.flexbuilder.multisdk.compiler.internal.ASItemBuilder.build(ASItemBuilder.java:74) at com.adobe.flexbuilder.project.compiler.internal.FlexProjectBuilder.buildItem(FlexProjectBuilder.java:480) at com.adobe.flexbuilder.project.compiler.internal.FlexProjectBuilder.build(FlexProjectBuilder.java:306) at com.adobe.flexbuilder.project.compiler.internal.FlexIncrementalBuilder.build(FlexIncrementalBuilder.java:157) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:627) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

    Read the article

  • Rails Atom builder xml.tag!("activity:object-type") error

    - by Anup
    I am creating a activity stream of my feeds according to the http://activitystrea.ms standard. I am using rails atom builder to create a valid atom feed, but when I use xml.tag!("activity:object-type", "http://activitystrea.ms/schema/1.0/person") the atom feed goes blank.On seeing the source I find the correct xml format from what I have found out the ":object" is giving the problem.

    Read the article

  • How to access Active Directory using C++Builder?

    - by Gus Brown
    I need to get a list of user names from Active Directory using C++Builder. I know I could shell out to batch file and run the csvde.exe command but surely there is a nicer way using a library or something, right? Are there any C++ libraries? (hopefully with examples?) Many thanks! -Dan

    Read the article

  • Reporter Builder 2.0

    - by ozsenegal
    I am developing a simple report in report builder,and i cant fix rows height bug. When a row has just one line it dont fit the text,and a whiteline appears below it,because others rows in the same grid ,has 2 or more lines. I try to change properties:"can shrink" and "can grow",but it doesnt solve. Any ideas?

    Read the article

  • PHP general form generator/builder

    - by Ehsan
    I'm looking for an open source php form builder or form generator to add/edit/delete/search records? I have to create a simple manager for some records, it's a common application that should be found easily, but I can't find any good code/class/application/etc :( Any help is appreciated.

    Read the article

  • UIViewController takes up entire screen in Interface Builder

    - by Sheehan Alam
    I have a NIB with a UIView that contains some UILabels, UIButtons etc. and a UIViewController that is loading a detached NIB. I want the UIViewController to be positioned below my UIView, but whenever I add it in Interface Builder it takes up the whole screen, and my UIView becomes part of the UIViewController. How can I make sure UIViewController appears below the UIView?

    Read the article

  • segemented control in iphone not appearing as in interface builder

    - by zecougar
    here is what i see in IB and here is what appears in the simulator i've used a segmented control with style = "Bezelled". When i change the style to "Bar", IB and simulator are consistent in the display. the style is set in interface builder and not in code, if that matters Also - the edges look rather ugly in the simulator. not what i expected even when it rendered incorrectly. Thanks in advance

    Read the article

  • WinCheat / WinSpy-like tool for C++ Builder exes

    - by mawg
    I just came back to C++ Builder after 5 or more years away. I seem to remember a nice tool where I could drag its pointer over the GUI of my running application and get lots of info about what was pointed at - handle, size, text, parent, children, etc IIRC, if the exe include debug info I could also get the actual variable name as used in the source. Does anyone know what program I am talking about? Thanks

    Read the article

  • Interface member name conflicts in ActionScript 3

    - by Aaron
    I am trying to create an ActionScript 3 class that implements two interfaces. The interfaces contain member functions with different signatures but the same name: public interface IFoo { function doStuff(input:int):void; } public interface IBar { function doStuff(input1:String, input2:Number):void; } public class FooBar implements IFoo, IBar { // ??? } In C# this problem can be solved with explicit interface implementations, but as far as I can tell ActionScript does not have that feature. Is there any way to create a class that implements both interfaces?

    Read the article

  • Regarding to get refrence of IDot11AdHocManager Interface of COM WiFi AdHoc manager Interface

    - by sathaliyawala
    I am Trying to create AdHoc connection and for this i am using AdHoc wifi Interface provided by Microsoft. I have written code :- IDot11AdHocManager *pIAdHocMng = NULL ; HRESULT hr = CoInitialize(NULL); hr = CoCreateInstance(CLSID_Dot11AdHocManager,NULL,CLSCTX_INPROC_HANDLER ,IID_IDot11AdHocManager ,(void**)pIAdHocMng); if(hr == S_OK) printf("CreateNetwork Method success due to following reason :\n %ld",hr) ; else printf("CreateNetwork Method fail due to following reason : %ld \n ",hr) ; getch(); CoUninitialize(); But it will not return reference of Dot11AdHocManager it will return error and NULL value please help me to get the reference of Dot11AdHocManager Interface so i can use it method which help me to create the AdHoc Network

    Read the article

  • Explicit C# interface implementation of interfaces that inherit from other interfaces

    - by anthony
    Consider the following three interfaces: interface IBaseInterface { event EventHandler SomeEvent; } interface IInterface1 : IBaseInterface { ... } interface IInterface 2 : IBaseInterface { ... } Now consider the following class that implements both IInterface1 and IInterface 2: class Foo : IInterface1, IInterface2 { event EventHandler IInterface1.SomeEvent { add { ... } remove { ... } } event EventHandler IInterface2.SomeEvent { add { ... } remove { ... } } } This results in an error because SomeEvent is not part of IInterface1 or IInterface2, it is part of IBaseInterface. How can the class Foo implement both IInterface1 and IInterface2?

    Read the article

  • Checking to see if a generic class is inherited from an interface

    - by SnOrfus
    I've got a class that inherits from an interface. That interface defines an event that I'd like to subscribe to in the calling code. I've tried a couple of things, but they all resolve to false (where I know it's true). How can I check to see if a class implements a specific interface. Here's what I've tried (note, the object in question is a usercontrol that implements MyInterface, stored in an array of controls, only some of which implement MyInterface - it is not null): if (this.controls[index].GetType().IsSubclassOf(typeof(MyInterface))) ((MyInterface)this.controls[index]).Event += this.Handler; if (this.controls[index].GetType().IsAssignableFrom(typeof(MyInterface))) ((MyInterface)this.controls[index]).Event += this.Handler; if (this.controls[index].GetType() == typeof(MyInterface)) ((MyInterface)this.controls[index]).Event += this.Handler; All to no avail.

    Read the article

  • Persist collection of interface using Hibernate

    - by Olvagor
    I want to persist my litte zoo with Hibernate: @Entity @Table(name = "zoo") public class Zoo { @OneToMany private Set<Animal> animals = new HashSet<Animal>(); } // Just a marker interface public interface Animal { } @Entity @Table(name = "dog") public class Dog implements Animal { // ID and other properties } @Entity @Table(name = "cat") public class Cat implements Animal { // ID and other properties } When I try to persist the zoo, Hibernate complains: Use of @OneToMany or @ManyToMany targeting an unmapped class: blubb.Zoo.animals[blubb.Animal] I know about the targetEntity-property of @OneToMany but that would mean, only Dogs OR Cats can live in my zoo. Is there any way to persist a collection of an interface, which has several implementations, with Hibernate?

    Read the article

  • Unresolved symbol when inheriting interface

    - by LeopardSkinPillBoxHat
    It's late at night here and I'm going crazy trying to solve a linker error. If I have the following abstract interface: class IArpPacketBuilder { public: IArpPacketBuilder(const DslPortId& aPortId); virtual ~IArpPacketBuilder(); // Other abstract (pure virtual methods) here... }; and I instantiate it like this: class DummyArpPacketBuilder : public IArpPacketBuilder { public: DummyArpPacketBuilder(const DslPortId& aPortId) : IArpPacketBuilder(aPortId) {} ~DummyArpPacketBuilder() {} }; why am I getting the following error when linking? Unresolved symbol references: IArpPacketBuilder::IArpPacketBuilder(DslPortId const&): ppc603_vxworks/_arpPacketQueue.o IArpPacketBuilder::~IArpPacketBuilder(): ppc603_vxworks/_arpPacketQueue.o typeinfo for IArpPacketBuilder: ppc603_vxworks/_arpPacketQueue.o *** Error code 1 IArpPacketBuilder is an abstract interface, so as long as I define the constructors and destructions in the concrete (derived) interface, I should be fine, no? Well it appears not.

    Read the article

  • How do I write an overload operator where both arguments are interface

    - by Eric Girard
    I'm using interface for most of my stuff. I can't find a way to create an overload operator + that would allow me to perform an addition on any objects implementing the IPoint interface Code interface IPoint { double X { get; set; } double Y { get; set; } } class Point : IPoint { double X { get; set; } double Y { get; set; } //How and where do I create this operator/extension ??? public static IPoint operator + (IPoint a,IPoint b) { return Add(a,b); } public static IPoint Add(IPoint a,IPoint b) { return new Point { X = a.X + b.X, Y = a.Y + b.Y }; } } //Dumb use case : public class Test { IPoint _currentLocation; public Test(IPoint initialLocation) { _currentLocation = intialLocation } public MoveOf(IPoint movement) { _currentLocation = _currentLocation + intialLocation; //Much cleaner/user-friendly than _currentLocation = Point.Add(_currentLocation,intialLocation); } }

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >