WCF / ASMX :: Use Ienumerable - Ienumerator And Iterator Interface In C#?
Sep 6, 2010how I used Ienumerable and ienumerator and itreator interface in c# with Wcf I want To used Through Class. I want To used Through C#
View 6 Replieshow I used Ienumerable and ienumerator and itreator interface in c# with Wcf I want To used Through Class. I want To used Through C#
View 6 Repliesrefer me few article which describe the basic use of IEnumerator and IEnumerable,
View 3 RepliesI'm having trouble with something that is (or should be) fairly straight-forward.
I have a recursive method that traverses an XML file, writing out the element tag names and values.
This is a snippet from the XML file:
[code]
<root>
<all_companies>
<company_group company_group_ID_attr="1">
<company_group_name>Cleaning</company_group_name>
<company_group_ID>1</company_group_ID>
<company company_ID_attr="2">
<name>Bloomburg</name>
<company_ID>2</company_ID>
<Address>blah blah blah</Address>
<employee_refs>
<employee_ref>4</employee_ref>
</employee_refs>
</company>
<company company_ID_attr="4">
<name>Morris</name>
<company_ID>4</company_ID>
<Address>blah blah blah</Address>
<employee_refs>
<employee_ref>3</employee_ref>
<employee_ref>1</employee_ref>
</employee_refs>
</company>
<company company_ID_attr="7">
<name>Ajax</name>
<company_ID>7</company_ID>
<Address>blah blah blah</Address>
<employee_refs>
<employee_ref>4</employee_ref>
<employee_ref>2</employee_ref>
</employee_refs>
</company>
</company_group>
</all_companies>
</root>
[/code]
I use the following XPath expression to access the first <company group> tag:
"root[1]/all_companies[1]/company_group[1]"
On the first call to the recursive method ("swrite_for_select_certain_stuff"),I see with the debugger that I reach the <company_group_name> tag. A recursive call at that point takes me to the text node within the tag ("Cleaning"), but it is a text type node (not an element), so it returns without writing anything to the output stream.
On return from that second call, things go wrong. The Iterator within the while loop returns false for the MoveNext method, when it should have moved to the <company_group_ID> tag (or so I think it should).
Am I missing something here?
OS is Win XP, and .NET is version 4.0.
My code is as follows:
[Code]....
i was looking at one example on msdn [URL], but i can't really understand it.
View 1 RepliesI have been founding an effiecent way to retreive values returned by LINQ 2 SQL stored procdure on my presentaion layer. Am using following method rightnow:-
public List<String> MthInvitesBA()
{
List<String> lst = new List<string> { "" };
ISingleResult<USP_Actor_View_InvitesDetails1Result> invites = obj.USP_Actor_View_InvitesDetails1(p_UserName);
foreach (USP_Actor_View_InvitesDetails1Result c in invites)
{
lst = new List<string> { c.Invites_Used.ToString(), c.NoOfDoc.ToString(), c.Request_For_More_Invites.ToString() };
return lst;
}
return lst;
}
It works but at the cost of my performence due boxing unboxing on BA layer as well as on design layer. Now, I have one method which returns me 100 columns from table So in this way i have convert 100 coulmns value into type string then On design layer again have to type caste some values .Moreover, i could only access this list using index which is of type integer, which is very diffcult and tedious task to debug d code. i could effiecenlt retreive these values. Is it possible using IEnumerable? How to access Ienuemerable in design layer?
I have a api which has multiple interfaces.I have set the ExternalDataExchangeAttribute before interface like below- <ExternalDataExchangeAttribute()> _Public Interface ILOBBaseFunction IsProposalDate(ByVal value As String) As BooleanEnd InterfaceI am getting the IsProposalDate function name as MethodName after selecting the
ILOBBase Interface Type in CallExternalMethodActivity of workflow foundation.It is working fine.
I need to use api interface that is running on jboss and I know the addressees to use.It's something like this
http://<server_name>/portalapi/<function_name>?<parameter1>=<value1>&<parameter2>=<value2>
So the question is how I can call this api from asp.net page or web service.I'm thinking of making one web service,buil ther all this methods that are using this api call's and then returning the info.
I would like to convert WSDL file to Service Contract Interface (WCF).
View 1 RepliesI need a way to show the display for an element in my list view like so:
[Code]....
Would it be possible to pass in a model to the DisplayFor method?
Maybe a syntax like this:
public static MvcHtmlString DisplayFor<TParentModel, TModel, TValue>(this HtmlHelper<TParentModel> html, TModel model, Expression<Func<TModel, TValue>> expression);
<%: Html.DisplayFor(item, i => i.BarBaz) %>
cmd_again =
new
SqlCommand
();
cmd_again.CommandText =
"select * from QMS_Processes1 where QMSParentProcessId=" +
id + ";"
;
cmd_again.CommandType =
CommandType
.Text;
cmd_again.Connection = con_again;
rdr_again = cmd_again.ExecuteReader();
System.Collections.
IEnumerator
ienum = rdr_again.GetEnumerator();
while
(ienum.MoveNext())
{}
now i want 3 fields in datareader how do i get that?? i tried to create instance of System.data.common.dataRecordInternal..but it didnt happen.
I have function it will return IEnumerable as.
IEM = myclass.getdata("name");
How to read the data in IEM as it consists of many columns. I have to display the values into labels and textboxes.
I am using LINQ for data connectivity and have made class which return me the result set into presentation here is the syntax:-
public List<ClsDermaInvestigation> MthdisplayInvestigation()
{
List<ClsDermaInvestigation> lstinvst = new List<ClsDermaInvestigation>();
ISingleResult<USP_Patient_Dermatology_InvestigationResult> investresult = objderma.USP_Patient_Dermatology_Investigation(PatientID, RepDate, Hb, TLC, F);
foreach(USP_Patient_Dermatology_InvestigationResult rel in investresult)
{
ClsDermaInvestigation objinvest = new ClsDermaInvestigation();
objinvest.Albumin = Convert.ToDouble(rel.Albumin);
objinvest.ALP = rel.ALP;
objinvest.ANA = rel.ANA;
objinvest.Date = rel.date;
lstinvest.add(objinvest)}return lstinvest}
This list is returning me the result.It works fine but in 1 case am using the same list to bind my Date dropdownlist.
//aspx.cs code
List<Dermatology.ClsDermaInvestigation> objlstinvest = objinvest.MthdisplayInvestigation();
//Array s = objlstinvest.to
drpDate.DataSource = s;
drpDate.DataTextField = "Repdate";
drpDate.DataValueField = "Repdate";
drpDate.DataBind();
But it throws an error that list does not conatin a property with "Repdate";. How can i bind this list with dropdownlist?? Can i convert it into some type so that i would be able to bind it??
table1 row = _db.table1.FirstOrDefault(r => r.ReferenceID == refNumber);
Is there anyway to cast row to IEnumerable?
((IEnumerable<table1>)row) - does not work
I'm trying to update values I have stored in an IEnumerable using UpdateModel, but it isn't reflecting the changes when I step over it in Debug.I also tried upating it using a foreach loop and updating the values in each object T within the IEnumerable<T>. The values are changed at the object level, but it seems that the value of the object in the IEnumerable isn't being changed.I was looking at IEnumerable<T> and didn't see a way to update it... I'm thinking that I might have to assign the updates to some other data structure, then convert it to an IEnumerable or something before I try to save my repository
View 6 RepliesI've read some articles about this but for some reason they're just not doing it for me. I'd like to understand the difference between
IEnumerable<string> myList and List<string>myListToo
I have IEnumerable object with value1 and value2. value2 is an array and value1 is string. I want to databind this object to Listview like that. So both value1 and value2[0] (always first item in array) could be accessed via <%# Eval("value1") %> and <%# Eval("value2") %> .
How to write expression to handle both items ?
ListViewItems.DataSource = f.Items.Select(t => t.value1, t.value2[0]);
ListViewItems.DataBind();
I have an IEnumerable< T> which is declared on the page like this:IEnumerable< Person> person;When the page postsback, the person list is null. How can I retain the values of person list without declaring it as static? Sr. devs in my company say that you should not declare the list as static.
View 2 RepliesDim list As List(Of DataRow) = dt.AsEnumerable().ToList()When I compile I get the error:
'AsEnumerable' is not a member of 'System.Data.DataTable'.I added Imports system.data.datatableextensions to the file..This code works when I run it on a asp.net project But when I use the same code in Website it returns the above error..Can anyone help solve this error.
i'm using MVC 2, RC, and i have a controller method:
[Code]....
and i have an <input type="file"../> in my form. during post, however, the files parameter is null.
My controller has a member that returns a JsonResult object, it is coded as per below. The problem is that Json(users) only returns the data from IEnumerable (MembershipUserEx objects) and I also want the data from the public Properties of MembershipUserExCollection as well. Is there a way to do this? I guess I am looking for the Json object to look something like this pseudo object:
results = {
pageIndex:0,
pageSize:50,
[code]...
Why it's not possible to cast a SiteMapNodeCollection (eg. SiteMap.CurrentNode.ChildNodes) to an IEnumerable<SiteMapNode>? I was wanting to do some filtering of the collection via LINQ, but this might not be possible?
The MSDN page says it implements IList, ICollection, and IEnumerable, so I don't see what the problem is.
I have a DetailsView control which gets data from a IEnumerable custom class. But I can't get updated values from the control so I can process to update them manually in the database. How can I do that?
View 2 RepliesI have a string which is stored as a cookie. The string is made up of the following data:
int userId
DateTime expiryDate
A user can have a number of these, so I store them like this "userId,expiryDate$userId,expiryDate"
When I retrieve the cookie value, I then split the string and add it to a list. The list is List<OpenReviews> openReviews, which contains the two variables above. I use the following piece of code to split the string:
string[][] reviews = value.Split( '$' ).Select( f => f.Split( ',' ) ).ToArray();
As you can see it goes to an array which I then have to iterate through to add it back into my list. All of which seems extremely long winded. I believe I can use the code above to put it into an IEnumerable<IEnumerable<string>> format. The problem is I don't know how to then get it into my List<OpenReviews> I'm therefore looking at getting the split string into my OpensReviews list as efficiently as possible.
I have an IEnumerable object (IEnumerable<Class>) and I would like to retrieve a specified line from the object. So if I'm on page two I would like to select row two from the IEnumerable object and then pass it on to another class etc. I'm a bit stuck at the moment, any ideas?
View 3 RepliesHow can i convert following sql guery to LINQ in C# ? I dont need all columns from both tables and the result set should be IEnumerable<DataRow>
select c.level,cl.name,c.quantity
from dbo.vw_categories c
left join dbo.vw_categoriesLocalization cl on c.level = cl.level and cl.language = 'en'
where c.level like '000%' and c.level <> '000';