Search Results

Search found 30 results on 2 pages for 'jaxidian'.

Page 2/2 | < Previous Page | 1 2 

  • Cannot serialize this List<T> extension

    - by Jaxidian
    I'm trying to push a subset of a collection of data through WCF to be consumed by WCF - think paged data. As such, I want this collection to have one page's worth of data as well as a total number of results. I figured this should be trivial by creating a custom object that extends List. However, everything I do results in my TotalNumber property coming across as 0. All of the data gets serialized/deserialized just fine but that single integer won't come across at all. Here's my first attempt that failed: [Serializable] public class PartialList<T> : List<T> { public PartialList() { } public PartialList(IEnumerable<T> collection) : base(collection) { } [DataMember] public int UnpartialTotalCount { get; set; } And here's my second attempt that failed in the exact same way: [Serializable] public class PartialList<T> : List<T>, ISerializable { public PartialList() { } public PartialList(IEnumerable<T> collection) : base(collection) { } [DataMember] public int UnpartialTotalCount { get; set; } protected PartialList(SerializationInfo info, StreamingContext context) { UnpartialTotalCount = info.GetInt32("UnpartialTotalCount"); } public void GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue("UnpartialTotalCount", UnpartialTotalCount); } } What's the deal here??

    Read the article

  • Cannot perform an ORDERBY against my EF4 data

    - by Jaxidian
    I have a query hitting EF4 using STEs and I'm having an issue with user-defined sorting. In debugging this, I have removed the dynamic sorting and am hard-coding it and I still have the issue. If I swap/uncomment the var results = xxx lines in GetMyBusinesses(), my results are not sorted any differently - they are always sorting it ascendingly. FYI, Name is a varchar(200) field in SQL 2008 on my Business table. private IQueryable<Business> GetMyBusinesses(MyDBContext CurrentContext) { var myBusinesses = from a in CurrentContext.A join f in CurrentContext.F on a.FID equals f.id join b in CurrentContext.Businesses on f.BID equals b.id where a.PersonID == 52 select b; var results = from r in myBusinesses orderby "Name" ascending select r; //var results = from r in results // orderby "Name" descending // select r; return results; } private PartialEntitiesList<Business> DoStuff() { var myBusinesses = GetMyBusinesses(); var myBusinessesCount = GetMyBusinesses().Count(); Results = new PartialEntitiesList<Business>(myBusinesses.Skip((PageNumber - 1)*PageSize).Take(PageSize).ToList()) {UnpartialTotalCount = myBusinessesCount}; return Results; } public class PartialEntitiesList<T> : List<T> { public PartialEntitiesList() { } public PartialEntitiesList(int capacity) : base(capacity) { } public PartialEntitiesList(IEnumerable<T> collection) : base(collection) { } public int UnpartialTotalCount { get; set; } }

    Read the article

  • Is there such a thing as a MemberExpression that handles a many-to-many relationship?

    - by Jaxidian
    We're trying to make it easy to write strongly-typed code in all areas of our system, so rather than setting var sortColumn = "FirstName" we'd like to say sortOption = (p => p.FirstName). This works great if the sortOption is of type Expression<Func<Person, object>> (we actually use generics in our code but that doesn't matter). However, we run into problems for many-to-many relationships because this notation breaks down. Consider this simple code: internal class Business { public IQueryable<Address> Addresses { get; set; } public string Name { get; set; } } internal class Address { public State MyState { get; set; } } internal class State { public string Abbreviation { get; set; } public int StateID { get; set; } } Is it possible to have this sort of MemberExpression to identify the StateID column off of a business? Again, the purpose of using this is not to return a StateID object, it's to just identify that property off of that entity (for sorting, filtering, and other purposes). It SEEMS to me that there should be some way to do this, even if it's not quite as pretty as foo = business.Addresses.SomeExtension(a => a.State.StateID);. Is this really possible? If more background is needed, take a look at this old question of mine. We've since updated the code significantly, but this should give you the general detailed idea of the context behind this question.

    Read the article

  • HttpWebRequest: The request was aborted: The request was canceled.

    - by Emeka
    I've been working on developing a middle man application of sorts, which uploads text to a CMS backend using HTTP post requests for a series of dates (usually 7 at a time). I am using HttpWebRequest to accomplish this. It seems to work fine for the first date, but when it starts the second date I get the System.Net.WebException: The request was aborted: The request was canceled. I've searched around and found the following big clues: http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/0d0afe40-c62a-4089-9d8b-fb4d206434dc http://www.jaxidian.org/update/2007/05/05/8 http://arnosoftwaredev.blogspot.com/2006/09/net-20-httpwebrequestkeepalive-and.html And they haven't been too helpful. I've tried overloading the GetWebReuqest but that doesn't make sense because I don't make any use of that function. Here is my code: http://pastebin.org/115268 I get the error on line 245 after it has run successfully at least once. I'd appreciate any help I can get as this is the last step in a project I've been working on for sometime. This is my first C#/VS project so I'm open to any tips but I would like to focus on getting this problem solved first. THanks!

    Read the article

  • Forcing a checkbox bound to a DataSource to update when it has not been viewed yet.

    - by Scott Chamberlain
    Here is a test framework to show what I am doing: create a new project add a tabbed control on tab 1 put a button on tab 2 put a check box paste this code for its code (use default names for controls) public partial class Form1 : Form { private List<bool> boolList = new List<bool>(); BindingSource bs = new BindingSource(); public Form1() { InitializeComponent(); boolList.Add(false); bs.DataSource = boolList; checkBox1.DataBindings.Add("Checked", bs, ""); this.button1.Click += new System.EventHandler(this.button1_Click); this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); } bool updating = false; private void button1_Click(object sender, EventArgs e) { updating = true; boolList[0] = true; bs.ResetBindings(false); Application.DoEvents(); updating = false; } private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (!updating) MessageBox.Show("CheckChanged fired outside of updating"); } } The issue is if you run the program and look at tab 2 then press the button on tab 1 the program works as expected, however if you press the button on tab 1 then look at tab 2 the event for the checkbox will not fire untill you look at tab 2. The reason for this is the controll on tab 2 is not in the "created" state, so its binding to change the checkbox from unchecked to checked does not happen until after the control has been "Created". checkbox1.CreateControl() does not do anything because according to MSDN CreateControl does not create a control handle if the control's Visible property is false. You can either call the CreateHandle method or access the Handle property to create the control's handle regardless of the control's visibility, but in this case, no window handles are created for the control's children. I tried getting the value of Handle(there is no public CreateHandle() for CheckBox) but still the same result. Any suggestions other than have the program quickly flash all of my tabs that have data-bound check boxes when it first loads? EDIT-- per Jaxidian's suggestion I created a new class public class newcheckbox : CheckBox { public new void CreateHandle() { base.CreateHandle(); } } I call CreateHandle() right after updating = true same results as before.

    Read the article

< Previous Page | 1 2