Search Results

Search found 15231 results on 610 pages for 'presentation model'.

Page 87/610 | < Previous Page | 83 84 85 86 87 88 89 90 91 92 93 94  | Next Page >

  • Nullable<> as TModel for ViewPage

    - by Alexander Prokofyev
    What are the possible reasons what Nullable<> types are disallowed to be passed as TModel parameter of System.Web.Mvc.ViewPage<TModel> generic? This could be handy sometimes. In ASP.NET MVC source defined what TModel should be a class: public class ViewPage<TModel> : ViewPage where TModel : class but Nullable types are value types. Maybe definition could be less restrictive...

    Read the article

  • Generic list typecasting problem

    - by AJ
    Hello, I'm new to C# and am stuck on the following. I have a Silverlight web service that uses LINQ to query a ADO.NET entity object. e.g.: [OperationContract] public List<Customer> GetData() { using (TestEntities ctx = new TestEntities()) { var data = from rec in ctx.Customer select rec; return data.ToList(); } } This works fine, but what I want to do is to make this more abstract. The first step would be to return a List<EntityObject> but this gives a compiler error, e.g.: [OperationContract] public List<EntityObject> GetData() { using (TestEntities ctx = new TestEntities()) { var data = from rec in ctx.Customer select rec; return data.ToList(); } } The error is: Error 1 Cannot implicitly convert type 'System.Collections.Generic.List<SilverlightTest.Web.Customer>' to 'System.Collections.Generic.IEnumerable<System.Data.Objects.DataClasses.EntityObject>'. An explicit conversion exists (are you missing a cast?) What am i doing wrong? Thanks, AJ

    Read the article

  • How can i return IEnumarable data from function in GridView with Entity FrameWork?

    - by programmerist
    protected IEnumerable GetPersonalsData() { // List personel; using (FirmaEntities firmactx = new FirmaEntities()) { var personeldata = (from p in firmactx.Personals select new { p.ID, p.Name, p.SurName }); return personeldata.AsEnumerable(); } } i wan to send GetPersonelData() into GridView DataSource. Like That: gwPersonel.DataSource = GetPersonelData(); gwPersonel.DataBind(); it monitored to me on : gwPersonel.DataBind(); this error: "The ObjectContext instance has been disposed and can no longer be used for operations that require a connection."

    Read the article

  • How to implement menuitems that depend on current selection in WPF MVVM explorer-like application

    - by Doug
    I am new to WPF and MVVM, and I am working on an application utilizing both. The application is similar to windows explorer, so consider an app with a main window with menu (ShellViewModel), a tree control (TreeViewModel), and a list control (ListViewModel). I want to implement menu items such as Edit - Delete, which deletes the currently selected item (which may be in the tree or in the list). I am using Josh Smith's RelayCommand, and binding the menuitem to a DeleteItemCommand in the ShellViewModel is easy. It seems like implementing the DeleteItemCommand, however, requires some fairly tight coupling between the ShellViewModel and the two child view models (TreeViewModel and ListViewModel) to keep track of the focus/selection and direct the action to the proper child for implementation. That seems wrong to me, and makes me think I'm missing something. Writing a focus manager and/or selection manager to do the bookkeeping does not seem too hard, and could be done without coupling the classes together. The windowing system is already keeping track of which view has the focus, and it seems like I'd be duplicating code. What I'm not sure about is how I would route the command from the ShellViewModel down to either the ListViewModel or the TreeViewModel to do the actual work without making a mess of the code. Some day, the application will be extended to include more than two children, and I want the shell to be as ignorant of the children as possible to make that extension as painless as possible. Looking at some sample WPF/MVVM applications (Karl Shifflett's CipherText, Josh Smith's MVVM Demo, etc.), I haven't seen any code that does this (or I didn't understand it). Regardless of whether you think my approach is way off base or I'm just missing a small nuance, please share your thoughts and help me get back on track. Thanks!

    Read the article

  • What does flushing thread local memory to global memory mean?

    - by Jack Griffith
    Hi, I am aware that the purpose of volatile variables in Java is that writes to such variables are immediately visible to other threads. I am also aware that one of the effects of a synchronized block is to flush thread-local memory to global memory. I have never fully understood the references to 'thread-local' memory in this context. I understand that data which only exists on the stack is thread-local, but when talking about objects on the heap my understanding becomes hazy. I was hoping that to get comments on the following points: When executing on a machine with multiple processors, does flushing thread-local memory simply refer to the flushing of the CPU cache into RAM? When executing on a uniprocessor machine, does this mean anything at all? If it is possible for the heap to have the same variable at two different memory locations (each accessed by a different thread), under what circumstances would this arise? What implications does this have to garbage collection? How aggressively do VMs do this kind of thing? Overall, I think am trying to understand whether thread-local means memory that is physically accessible by only one CPU or if there is logical thread-local heap partitioning done by the VM? Any links to presentations or documentation would be immensely helpful. I have spent time researching this, and although I have found lots of nice literature, I haven't been able to satisfy my curiosity regarding the different situations & definitions of thread-local memory. Thanks very much.

    Read the article

  • Is this part of MVC in .NET?

    - by 4thSpace
    I have a .NET MVC winform app. I've created an AppDelegate class that handles application startup and shutdown...for now (it might do more later). Winform apps have a Program.cs file that does some app initialization, starts the message pump and creates the first form. In my app, the first form is AppDelegate, which isn't really a form but is forced that way by Application.Run(). AppDelegate does any further app initialization and starts the first Controller, which then initializes any child controllers (these then create their views). I don't consider events occuring in Program.cs and AppDelegate as part of the MVC. Conceptually, what would these be called?

    Read the article

  • Cyclic References and WCF

    - by Kunal
    I have generated my POCO entities using POCO Generator, I have more than 150+ tables in my database. I am sharing POCO entities all across the application layers including the client. I have disabled both LazyLoading and ProxyCreation in my context.I am using WCF on top of my data access and business layer. Now, When I return a poco entity to my client, I get an error saying "Underlying connection was closed" I enabled WCF tracing and found the exact error : Contains cycles and cannot be serialized if reference tracking is disabled. I Looked at MSDN and found solutions like setting IsReference=true in the DataContract method atttribute but I am not decorating my POCO classes with DataContracts and I assume there is no need of it as well. I won't be calling that as a POCO if I decorate a class with DataContract attribute Then, I found solutions like applying custom attribute [CyclicReferenceAware] over my ServiceContracts.That did work but I wanted to throw this question to community to see how other people managed this and also why Microsoft didn't give built in support for figuring out cyclic references while serializing POCO classes

    Read the article

  • Entity Relationship Multiple 1:1's

    - by Evan
    I have an application where I have a generic object (table) called Hull. Each hull in the table is unique. I have another object that has three hulls, but they are specifically the Port_Hull, Center_Hull and Starboard_Hull. Rather than create a One to Many relationship, I was trying to create a one to one relationship for each one, but this results in numerous errors unless I make the relationship from Hull to Vessel one to many (which it is not). Any idea how I go about this, or should I abandon the concept and make the vessel to hull relationship one to many and deal with lists that always have three entries? p.s. Using uniqueidentifiers as many users can be adding records while disconnected. Hull Table HullID uniqueidentifier (primary key) plus bunch of hull data fields Vessel Table VesselID uniqueidentifier (primary key) MainHullID uniqueidentifier (tried as key and non-key) PortHullID uniqueidentifier StarboardHullID uniqueidentifier plus bunch of Vessel data fields

    Read the article

  • How to access the subject of a compose mail item in Outlook

    - by vwfreak034
    In Outlook, I can set the subject for a new message (when composing a new mail message), but I want to prepend text. So I need to get the subject first, and then set it. Outlook.Application application = Globals.ThisAddIn.Application; Outlook.Inspector inspector = application.ActiveInspector(); Outlook.MailItem myMailItem = (Outlook.MailItem)inspector.CurrentItem; if (myMailItem != null && !string.IsNullOrEmpty(myMailItem.Subject)) { myMailItem.Subject = "Following up on your order"; } This code works on replies, but not for new messages, because in that case, myMailItem is null.

    Read the article

  • Association not imported in EF4 designer for non-primary key

    - by Rommel Manalo
    The relationship 'FK_EXTERNAL_ISMARKETI_MARKETIN' has columns that are not part of the key of the table on the primary side of the relationship. The relationship was excluded. USE [Instruments.UnitTest] GO ALTER TABLE [Instr].[ExternalIdentification] WITH CHECK ADD CONSTRAINT [FK_EXTERNAL_ISMARKETI_MARKETIN] FOREIGN KEY([InstrumentID], [MarketInstrumentID]) REFERENCES [Instr].[MarketInstrument] ([InstrumentID], [MarketInstrumentID]) GO ALTER TABLE [Instr].[ExternalIdentification] CHECK CONSTRAINT [FK_EXTERNAL_ISMARKETI_MARKETIN] GO I'm using an association for NON-PRIMARY KEY columns, is this possible in the EF4?

    Read the article

  • In Ruby on Rails, why will story.votes return an empty Array object, but story.votes.create will act

    - by Jian Lin
    In Ruby on Rails, say a Story object can "has_many" Vote objects (a story is voted "hot" by many users). So when we do a s = Story.find(:first) s is a Story object, and say s.votes returns [] and s.votes.class returns Array So clearly, s.votes is an empty Array object. At this time, when s.votes.create is called, it actually invokes a method of the Vote class? How come an Array class object can invoke a Vote class method?

    Read the article

  • What is the best database structure for this scenario?

    - by Ricketts
    I have a database that is holding real estate MLS (Multiple Listing Service) data. Currently, I have a single table that holds all the listing attributes (price, address, sqft, etc.). There are several different property types (residential, commercial, rental, income, land, etc.) and each property type share a majority of the attributes, but there are a few that are unique to that property type. My question is the shared attributes are in excess of 250 fields and this seems like too many fields to have in a single table. My thought is I could break them out into an EAV (Entity-Attribute-Value) format, but I've read many bad things about that and it would make running queries a real pain as any of the 250 fields could be searched on. If I were to go that route, I'd literally have to pull all the data out of the EAV table, grouped by listing id, merge it on the application side, then run my query against the in memory object collection. This also does not seem very efficient. I am looking for some ideas or recommendations on which way to proceed. Perhaps the 250+ field table is the only way to proceed. Just as a note, I'm using SQL Server 2012, .NET 4.5 w/ Entity Framework 5, C# and data is passed to asp.net web application via WCF service. Thanks in advance.

    Read the article

  • Problem with date_select when using :discard option. (Rails)

    - by MikeH
    I'm using a date_select with the option :discard_year => true If a user selects a date in the date select, and then he comes back and returns the select to the prompt values of Month and Day, Rails automatically sets the select values to January 1. I know this is the intended functionality if a month is selected and a day is left blank, but that's not the case here. In my example, the user sets both the month and day back to the prompt. By Rails forcing January 1, I'm getting bad results. I've tried every parameter available in the api. :default = nil, :include_blank = true. None of those change the behavior I'm describing. I've isolated the root of the problem, which is this: Because I'm discarding the :year parameter, when the user tries to return the month and day to the prompt values, Rails doesn't see an empty prompt select. It perhaps sees a year selected with empty month and day, which it then sets to January 1. This is the case because the :discard_year parameter does in fact set a date in the database, it just removes it from the view. How can I code around this problem?

    Read the article

  • In Prism (CAL), how can I RegisterPresenterWithRegion instead of RegisterViewWithRegion

    - by Edward Tanguay
    I have a module in a Prism application and in its initialize method I want to register a presenter instead of a view with a region, i.e. I want to do this: PSEUDO-CODE: regionManager.RegisterPresenterWithRegion( "MainRegion", typeof(Presenters.EditCustomerPresenter)); instead of loading a view like this: regionManager.RegisterViewWithRegion( "MainRegion", typeof(Views.EditCustomerView)); The presenter would of course bring along its own view and ultimately register this view in the region, but it would allow me to bind the presenter to the view in the presenter's constructor instead of binding the two together in XAML (which is more of a decoupled MVVM pattern which I want to avoid here). How can I add a Presenter to a Region instead of a view? namespace Client.Modules.CustomerModule { [Module(ModuleName = "CustomerModule")] public class CustomerModule : IModule { private readonly IRegionManager regionManager; public CustomerModule(IRegionManager regionManager) { this.regionManager = regionManager; } public void Initialize() { regionManager.RegisterViewWithRegion("MainRegion", typeof(Views.EditCustomerView)); } } }

    Read the article

  • How set opacity on QGraphicsItem

    - by La Chamelle
    Hello, i have a inherited from QGraphicsScene and QGraphicsItem to create my own classes. I use Qt 4.6. I want to set a specific opacity on each items of my scene. I use setOpacity : setOpacity method, but its not the result i hope. I want to have for example one item opaque and an other transparent (to see the desktop, or the other application). But if i dont set the opacity of the QGraphicsView to 0.5, i have not the transparancy. And if the QGraphicsView is set to 0.5, the item is not real opaque. What should i do ? Thanks you.

    Read the article

  • Rails :dependent => :destroy VS :dependent => :delete_all

    - by Sergey
    In rails guides it's described like this: "Objects will be in addition destroyed if they’re associated with :dependent = :destroy, and deleted if they’re associated with :dependent = :delete_all." Right, cool. But what's the difference between being destroyed and being deleted? I tried both and it seems to do the same thing.

    Read the article

  • Storing n-grams in database in < n number of tables.

    - by kurige
    If I was writing a piece of software that attempted to predict what word a user was going to type next using the two previous words the user had typed, I would create two tables. Like so: == 1-gram table == Token | NextWord | Frequency ------+----------+----------- "I" | "like" | 15 "I" | "hate" | 20 == 2-gram table == Token | NextWord | Frequency ---------+------------+----------- "I like" | "apples" | 8 "I like" | "tomatoes" | 12 "I hate" | "tomatoes" | 20 "I hate" | "apples" | 2 Following this example implimentation the user types "I" and the software, using the above database, predicts that the next word the user is going to type is "hate". If the user does type "hate" then the software will then predict that the next word the user is going to type is "tomatoes". However, this implimentation would require a table for each additional n-gram that I choose to take into account. If I decided that I wanted to take the 5 or 6 preceding words into account when predicting the next word, then I would need 5-6 tables, and an exponentially increase in space per n-gram. What would be the best way to represent this in only one or two tables, that has no upper-limit on the number of n-grams I can support?

    Read the article

  • MVP - asp.net - passing information via views - confused

    - by ekynox
    Hi, I've just started to play around with MVP in asp.net. One thing I quite cant figure out is how do I pass information, i.e. an integer variable from one view(webform) to another. Let's I have a customerlistView which is mapped to a customerlist.aspx page. From it I select a customer and it's record id. Say I want to display the customer's details in another view (i.e customerDetailView, customerdetail.aspx). How do I achieve that ? Does that mean customerlistView would call the presenter of the customerdetail and cause a page redirect ? Any ideas ? thanks

    Read the article

  • Using a "vo" for joined data?

    - by keithjgrant
    I'm building a small financial system. Because of double-entry accounting, transactions always come in batches of two or more, so I've got a batch table and a transaction table. (The transaction table has batch_id, account_id, and amount fields, and shared data like date and description are relegated to the batch table). I've been using basic vo-type models for each table so far. Because of this table structure structure, though, transactions will almost always be selected with a join on the batch table. So should I take the selected records and splice them into two separate vo objects, or should I create a "shared" vo that contains both batch and transaction data? There are a few cases in which batch records and/or transaction records. Are there possible pitfalls down the road if I have "overlapping" vo classes?

    Read the article

  • Display values inside a JList -

    - by sharon Hwk
    I have a method that returns a HashMap, and is defined as follows; public HashMap<Integer, Animal> allAnimal(){ return returnsAHashMap; } Animal will have the following values in its class: public Animal{ int animalID; String animalName; // i have declared getters/setters } I have a GUI screen which has a JList and it's defined as: l = new JList(); l.setModel(new AbstractListModel() { String[] v = new String[] {"animal id 1", "2", "3"}; public int getSize() { return v.length; } public Object getElementAt(int index) { return v[index]; } }); What I want to do is to display the AnimalID's in the JList. I need to find a way to call the allAnimal() method and display all its Animal Id's in the JList. How can i do this ?

    Read the article

< Previous Page | 83 84 85 86 87 88 89 90 91 92 93 94  | Next Page >