Hi, In one of my tables I have a column with type char(1). When I used LINQ to SQL, this column was correctly mapped to "char" type but when using Entity Framework its being mapped to "String" type as opposed to "char". Also there isn't seem to be an option in the Type drop down to select "char". Can anyone shed some light on this matter?
student_rhr
Posts
-
Entity Framework and 'char' type mapping -
TFS BuildDefinition - Environment based dllsThanks for answering. Above mentioned is actually the source control folder structure. Perhaps I do not understand the relative path technique, meaning I am not sure if you are referring to relative paths in the Build definitions file of if you are talking about ASP.NET references. Would you mind elaborating it a bit? Thanks again for your help.
-
TFS BuildDefinition - Environment based dllsHi, How can I configure my TFS build to pick up dlls based on the build environment. For instance my directory structure is like this:
Source |______ build |______ environment |______ LIB |_____________ DEV |_____________ LOCAL |_____________ PROD |_____________ UAT |______ src |_____________ net |___________________ myProjectDirectory |______ mySolutionFile.sln
What we are needing to do is to create a build for DEV, UAT and PROD environment. We have some 3rd party dlls which reside in lib > DEV, lib > UAT, and lib > PROD. So essentially for DEV build we need to pick the dll from the lib > DEV directory, UAT build we need the dll from lib > UAT directory .. so on .. you get the idea. Can this be accomplished? I know I havent been able to find a way to do it using Build Definition Wizard. I would appreciate your help. -
ASP.NET AJAX Postback Not Updating DOM?Yeah I didn't think that was the case but I just wanted to make sure. Sometimes small things like that can cause major issues :) Also, I looked at your website ... nice design. Unfortunately I wasn't able to get much in terms of, behavior or test data, from the comment page as I wasn't able to add a comment at all. It seemed like it worked at first but then I kept getting a 404 error. I have never worked with tinMCE .... but if time allows I'll try to download tinyMCE and see if I can get it to work in a relatively simpler example similar to yours. Sorry wish I could be of more help. Good luck.
-
Async updates to DB without BackgroundWorkerThanks Navaneeth.
ProgressHelper
is my internal DAL responsible for udpating the progress table (sorry I should have explained). I agree with you that BackgroundWorker is a bad idea that's why I was wondering if there might be a better way to accomplish this. Also, what are your thoughts about Async Delegates? Have you seen any adverse effects of using them in ASP.NET? Appreciate your hlep! -
ASP.NET AJAX Postback Not Updating DOM?Probably not the case but I see that your UpdatePanel is set to ConditionalUpdate referring to btnSubmit's onclick event. OnClick is set to "btnSubmit_Click" however your update logic is within "button_click"! Also, if above is not true, what exactly is Save() function doing which is being called onClientClick?
-
Async updates to DB without BackgroundWorkerHi, In my ASP.NET application, I have a situation where I am doing a lot of computing and database reads/inserts/updates. I needed to gather statistics on the processing records. This info is actually displayed on another webpage. Processing routine looks something like this:
public void Process() { int recordCount = 0; ProgressHelper.Start(); while(processing) { //Actual processing logic recordCount++; //Every 10 processed records, update the progress table if(recordCount % 10 == 0) { ProgressHelper.UpdateProcessedRecordCount(recordCount); } } ProgressHelper.End(); }
These database calls to update the progress add additional delay. I was wondering if there is a way to actually execute all the ProgressHelper stuff asynchronously (without using background worker)? (perhaps delegates ... but are delegates really async?)
-
Design Question (Class vs Structs)Hi Everyone, I have a "one to many" sort of situation. I am using a Key to get subset data. I started out using a class like this:
public class Contract { public int ContractID {get;set;} public int CustomerID {get;set;} public string CustomerName {get;set;} public string Organization {get;set;} public int TermsID {get;} } //Then data mapper public class ContractDataMapper { public static List<Contract> GetContractData(int contractID) { List<Contract> returnValue = new List<Contract>(); ... /*data retrieval logic*/ while(reader.Read()) { Contract contract = new Contract(); contract.CustomerID = Convert.ToInt32(reader["CustomerID"]); contract.CustomerName = reader["CustomerName"].ToString(); ... if(!returnValue.Contains(contract)) returnValue.Add(contract); } reader.Close(); command.Dispose(); return returnValue(); } }
But I soon realized that this is bad because I had to check to see if this ContractID has any TermsID associated with it and the way it currently is I would have to do something like:
if(ContractDataMapper.GetContractData(1234)[0].TermsID > 0) // Do something
Ideally I should have one class Contract and have other properties in a subclass. Now my question is ... do you think it would be better to have a struct or a subclass or something else?
// Something like this Contract contract = new Contract(1234); List<SubsetData> subset = contract.SubsetData;
I would appreciate your help.
-
variables returning to nullCan you post your code? That will help determine the problem.
-
database topic in asp.netHave you tried putting the database file to the App_data folder?
-
Parsing incoming DateTime in C# WebService myself?What about using an overload that way if it is passed in as something other then a valid DateTime object it will get treated by the overlaoded method and there you can try parsing it manually:
[WebMethod] public ReturnList GetList(string id, string fromDate) { // overlaod // your parsing logic } [WebMethod] public ReturnList GetList(string id, System.DateTime fromDate) { // Original function }
Worth a try ... hth
-
publically readonly but internally writable objects?I was wondering if somehow it is possible to make objects readonly if referenced by another assembly but writeable when accessed internally? For example I have a scenario where I need to pass objects to UI. UI must not be allowed to temper with the object in any form or fashion but the business layer should have full access to the object as we need to do some computation after the object is inialized by the DAL. I was just wondering if there is a preferred way of dealing with situations like these that I am not aware of? Would appreciate the help ... Thanks in advance.
-
File UploadI have a gridview with a file upload:
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource2" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black" GridLines="Vertical" DataKeyNames="Program_ID" Width="387px">
<Columns>
<asp:BoundField DataField="Program_ID" HeaderText="Program ID" SortExpression="Program_ID" />
<asp:TemplateField HeaderText="Image Files for Program">
<ItemTemplate>
<asp:FileUpload ID="fileUpload" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#CCCCCC" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#CCCCCC" />
</asp:GridView>For some reason, on postback, I am not getting any value from the file upload control:
//Button Click
foreach (GridViewRow row in GridView2.Rows)
{
FileUpload fileUpload = (FileUpload)row.FindControl("fileUpload");
//Response.Write(fileUpload.FileName);
if (!String.IsNullOrEmpty(fileUpload.FileName.Trim()))
{
// use the first file name for all if checkbox is checked.
if (chkImageFile.Checked)
{
if (String.IsNullOrEmpty(tempFileName))
{
tempFileName = fileUpload.FileName;
fileUpload.SaveAs(Server.MapPath("~/"));
}
}
else
tempFileName = fileUpload.FileName;
}
}Any idea whats going on? P.S. I am using ajax but for this task a i am doing a complete postback. None of the controls listed here are inside an update panel.
-
LoggedInTemplateIs the control you are looking for in active template? What this mean is that with loginview control only one template is active at any given time i.e. its either if user is not logged in or if use is logged in. Make sure the control you are looking for is within active template. \ hth
-
Add Multiple Hyperlink control dynamically on button_click eventWhat does your code look like that you are using to create the hyperlink? You can put a Panel control on your page on the click event do something like
MyPanel.Controls.Add(new LiteralControl(String.Format("{0}", strFileUploadPath));
I havent tested this yet but it should work ... let me know if this helps or not.
-
Start a process on Page_Load but dont wait for it!!Hello everyone, I am needing to start a long process when the user very first visits a web page. However I do not want to wait for the process to end. I need for it to work in the background as that process has nothing to do with UI and no confirmation is required when the process is finished. Is there a way I can do that? Would appreciate your help.
-
Help in selecting attributes with XPath [modified]<field name="textBox" y="3.175" x="3.17" w="62" h="9"> <ui> <textBox> <border> <css style=""> </css> </border> <margin/> </textBox> </ui> <font face="Arial"/> <margin topInset="1" bottomInset="1" leftInset="1" rightInset="1"/> <textAlign vAlign="middle"/> <label reserve="25"> <Font fontFace="Arial" size="8pt" /> <textAlign vAlign="middle"/> <value> <text>textbox label</text> </value> </label> </field>
So I am trying to read the values of Font (IF there is a textBox element present) and trying to read the attributes fontFace and size, here is my Xpath:
XPathNodeIterator iterator = nav.Select(@"/field"); try { while (iterator.MoveNext()) { //Do some other stuff ... XPathNavigator nav2 = iterator.Current.Clone(); if (string.Compare(nav2.Name, "field") == 0) { XPathNodeIterator textBoxIterator = nav2.Select("child::*/child::textBox"); if (textBoxIterator.Count > 0) { XPathExpression exp = nav2.Compile("child::Font"); XPathNodeIterator it = nav2.Select(exp); while (it.MoveNext()) { XPathNavigator nav3 = it.Current.Clone(); string fontFace = nav3.GetAttribute("typeface", nav3.NamespaceURI); string fontSize = nav3.GetAttribute("size", nav3.NamespaceURI); } } } } catch ... }
Am I doing it the proper way or is it too complicated and can be simplified?
modified on Tuesday, March 4, 2008 10:22 AM
-
Control Selection & Resizing at RuntimeCheckout this article: http://www.codeproject.com/KB/miscctrl/CSharpRectTracker.aspx[^]
-
ListBox and objectswell I ended up doing something like this:
Dictionary<int, UserControl> dic = new Dictionary<int, UserControl>(); ... int count = 0; foreach (UserControl c in mb.UserControls) { listBox1.Items.Add(c.Name); dic.Add(count, c); count++; }
and when user double clicks a control I simply use the selectedIndex to pull the control out from dictionary
foreach (KeyValuePair<int, UserControl> kvp in dic) { if (kvp.Key == listBox1.SelectedIndex) { MessageBox.Show(kvp.Value.Name, kvp.Value.Size.ToString()); winForm.Controls.Add(kvp.Value); } }
is that a terrible solution?
-
ListBox and objectsI have an ArrayList populated with UserControl objects. I need to display this list on a windows form and when a user clicks on any of the items I need display the properties of the control. I thought I could use ListBox control since we can populate it with the objects. But the problem is that when I populate the list box I dont get any text values. And if you click on the list box you can clearly see where the items were populated but no textual representation for it.
foreach(UserControl c in mb.UserControls) { listBox1.Items.Add(c); }
unless i do:
foreach(UserControl c in mb.UserControls) { listBox1.Items.Add(c.ToString()); }
Its something really simple but for some reason I am not getting it. Would appreciate some help. Thanks.