Axiom: what you do in your youth shall be stricken from the record...this applies generally to pretty much everything.
On Sun, Nov 7, 2010 at 5:05 PM, Diego Mijelshon <[email protected]>wrote: > Actually........ several years ago, I wrote a few apps using a data layer I > wrote that was based on "FOR XML" and similar constructs of SQL Server. > > For example. my Get<T> method looked like: > > return Context.SQL.Execute<T>(string.Format(@" > SELECT * > FROM {0} > WHERE Id = @Id > FOR XML AUTO, ELEMENTS > ", typeof(T).Name), > new Parameter("@Id", id)); > > And SQL.Execute was: > public T Execute<T>(string commandText, params Parameter[] parameters) > where T : class > { > return ExecuteCore<T>(commandText, parameters, delegate(IDbCommand command) > { > using (XmlReader reader = (command as SqlCommand).ExecuteXmlReader()) > { > SqlXmlReader myReader = new SqlXmlReader(reader); > XmlSerializer serializer = new XmlSerializer(typeof(T)); > return (T)serializer.Deserialize(myReader); > } > }); > } > > Disclaimer: I was young(er). > > Diego > > On Sun, Nov 7, 2010 at 15:54, Jeffry Morris <[email protected]>wrote: > >> Your better off using some sort of serialization method to convert your >> objects to xml _after_ they have been loaded from your query. For example: >> >> 1. Have objects you wish to serialize to xml implement >> IXmlSerializable - >> >> http://msdn.microsoft.com/en-us/library/system.xml.serialization.ixmlserializable.aspx >> 2. Load objects from your db via query from NH >> 3. Serialize objects to Xml (document, stream, string...whatever) >> 4. Apply XmlTransform to that output >> >> Alternatively you could use Linq to Xml to convert query results to Xml as >> well - http://msdn.microsoft.com/en-us/library/bb387098.aspx >> >> As far as using FOR XML in the database...that is the domain of the DBA, >> not the developer. >> >> -Jeff >> >> >> On Sat, Nov 6, 2010 at 10:32 PM, Fabio Maulo <[email protected]>wrote: >> >>> - Too much work for one guy (data server). >>> - Instead work with your domain object graph you will end working with >>> Table+Column (2 dimensions) >>> - A little change in persistence representation will mean a change in >>> your query >>> - and so on... >>> >>> btw... Taste is taste >>> >>> -- >>> Fabio Maulo >>> >>> >>> El 06/11/2010, a las 06:39, SAMI AKKUS <[email protected]> escribió: >>> >>> I am developing CMS. I have a domain model. in addition, I want to >>> take some data as xml and transform it. I dont want add extra ado jobs to my >>> DAL. Therefore I need such a spesification. >>> >>> Thank you very much. >>> >>> >>> 2010/11/6 Fabio Maulo < <[email protected]>[email protected]> >>> >>>> NHibernate returns entities or projections. If you don't use 'TYPE', as >>>> seems to be your case, you should be able to catch the result as a scalar >>>> of >>>> type string (you have to assign an alias to the result). >>>> >>>> After do that, ask yourself why you are using NHibernate to get such >>>> result. >>>> >>>> On Fri, Nov 5, 2010 at 7:33 PM, SAMI AKKUS < <[email protected]> >>>> [email protected]> wrote: >>>> >>>>> Yes, for example, can I use CreateSQLQuery("SELECT * FROM table FOR >>>>> XML AUTO"). Then NH returns string or xml. >>>>> >>>>> >>>>> >>>>> 2010/11/6 Fabio Maulo < <[email protected]>[email protected]> >>>>> >>>>>> directly from the RDBMS and not from your domain, right ? >>>>>> >>>>>> >>>>>> On Fri, Nov 5, 2010 at 7:09 PM, SAMI AKKUS < <[email protected]> >>>>>> [email protected]> wrote: >>>>>> >>>>>>> Yes i want to take data as XML and transform with xslt. >>>>>>> 2010/11/5, Fabio Maulo < <[email protected]>[email protected] >>>>>>> >: >>>>>>> > let me understand... >>>>>>> > what you are looking for is create an XML directly from the data in >>>>>>> the DB ? >>>>>>> > >>>>>>> > On Fri, Nov 5, 2010 at 3:51 PM, zamix < <[email protected]> >>>>>>> [email protected]> wrote: >>>>>>> > >>>>>>> >> How can I write queries in NH, which end with FOR XML AUTO or FOR >>>>>>> XML >>>>>>> >> RAW. >>>>>>> >> >>>>>>> >> -- >>>>>>> >> You received this message because you are subscribed to the Google >>>>>>> Groups >>>>>>> >> "nhusers" group. >>>>>>> >> To post to this group, send email to <[email protected]> >>>>>>> [email protected]. >>>>>>> >> To unsubscribe from this group, send email to >>>>>>> >> <nhusers%[email protected]> >>>>>>> [email protected]< >>>>>>> nhusers%[email protected]<nhusers%[email protected]> >>>>>>> > >>>>>>> >> . >>>>>>> >> For more options, visit this group at >>>>>>> >> <http://groups.google.com/group/nhusers?hl=en> >>>>>>> http://groups.google.com/group/nhusers?hl=en. >>>>>>> >> >>>>>>> >> >>>>>>> > >>>>>>> > >>>>>>> > -- >>>>>>> > Fabio Maulo >>>>>>> > >>>>>>> > -- >>>>>>> > You received this message because you are subscribed to the Google >>>>>>> Groups >>>>>>> > "nhusers" group. >>>>>>> > To post to this group, send email to <[email protected]> >>>>>>> [email protected]. >>>>>>> > To unsubscribe from this group, send email to >>>>>>> > <nhusers%[email protected]> >>>>>>> [email protected]. >>>>>>> > For more options, visit this group at >>>>>>> > <http://groups.google.com/group/nhusers?hl=en> >>>>>>> http://groups.google.com/group/nhusers?hl=en. >>>>>>> > >>>>>>> > >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "nhusers" group. >>>>>>> To post to this group, send email to <[email protected]> >>>>>>> [email protected]. >>>>>>> To unsubscribe from this group, send email to >>>>>>> <nhusers%[email protected]> >>>>>>> [email protected]. >>>>>>> For more options, visit this group at >>>>>>> <http://groups.google.com/group/nhusers?hl=en> >>>>>>> http://groups.google.com/group/nhusers?hl=en. >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Fabio Maulo >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "nhusers" group. >>>>>> To post to this group, send email to <[email protected]> >>>>>> [email protected]. >>>>>> To unsubscribe from this group, send email to >>>>>> <nhusers%[email protected]> >>>>>> [email protected]. >>>>>> For more options, visit this group at >>>>>> <http://groups.google.com/group/nhusers?hl=en> >>>>>> http://groups.google.com/group/nhusers?hl=en. >>>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "nhusers" group. >>>>> To post to this group, send email to <[email protected]> >>>>> [email protected]. >>>>> To unsubscribe from this group, send email to >>>>> <nhusers%[email protected]> >>>>> [email protected]. >>>>> For more options, visit this group at >>>>> <http://groups.google.com/group/nhusers?hl=en> >>>>> http://groups.google.com/group/nhusers?hl=en. >>>>> >>>> >>>> >>>> >>>> -- >>>> Fabio Maulo >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "nhusers" group. >>>> To post to this group, send email to <[email protected]> >>>> [email protected]. >>>> To unsubscribe from this group, send email to >>>> <nhusers%[email protected]> >>>> [email protected]. >>>> For more options, visit this group at >>>> <http://groups.google.com/group/nhusers?hl=en> >>>> http://groups.google.com/group/nhusers?hl=en. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "nhusers" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/nhusers?hl=en. >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "nhusers" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]<nhusers%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/nhusers?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "nhusers" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<nhusers%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/nhusers?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
