Re: Dump EntityFramework for LLBLGen
David, That's interesting - I'm working on a fairly large in production app using EF at the moment. We're not using POCO and currently have 259 tables in the EDMX. What's the magic number that you ran into? I also must admit that I agree with a lot of the things that Scott and some of the other posters have said. While EF does generate some quite interesting SQL under the covers the majority of the time it has been reasonable enough for our purposes. For the times that it hasn't we have custom rolled a few stored procs to cover the issues. Neil. On 13 April 2012 18:53, wrote: > There are limitations to EF. A project here was started with ef but soon ran > into obstacles when the number of tables mapped was greater than the number > possible in ef. It's now using hand written dal that is a damn sight faster > as well. > > EF / NHibernate are tools, use the right tool for the right job. > > Davy > Hexed into a portable ouija board. > > From: Arjang Assadi > Sender: ozdotnet-boun...@ozdotnet.com > Date: Fri, 13 Apr 2012 11:05:45 +1000 > To: ozDotNet > ReplyTo: ozDotNet > Subject: Re: Dump EntityFramework for LLBLGen > > One Word: EF Code First! and I haven't looked back ever since. > DAL is dead, Long live Entities > > Regards > > Arjang > On 13 April 2012 10:59, wrote: >> >> Been using llbLgen for years but finding that EF would do what i need. >> >> >> >> Would save me a step(time) using EF in vs 2010 instead of generate DAL >> using LLblgen >> >> >> >> Anyone have an opinion on this? >> >> >> >> >> >> Anthony > >
Trouble converting utf-8 resource to string
Folks, I have an XML file as an embedded resource. The file looks like this and I know it's utf-8 encoded because in the binary editor I can see it starts with 0xEFBBBF Foobar However, when I run the following code to get the raw bytes from the resource and convert it to a string I don't get the nice string I expect. The resulting string starts with the character 0xfeff which is a Unicode BOM and then XDocument dies attempting to parse that string. using (Stream s = typeof(Program).Assembly.GetManifestResourceStream("MyProgram.XMLFile1.xml") ) { byte[] buff = new byte[s.Length]; s.Read(buff, 0, buff.Length); string xml = Encoding.UTF8.GetString(buff, 0, buff.Length); XDocument doc2 = XDocument.Parse(xml); // This dies because xml[0] is the character 0xfeff } I've tried different overloads of Encoding classes but it makes no difference. I could have sworn I was a boffin of bytes and encoding, but I've no idea what's going on here. Any ideas anyone? Greg
Re: Trouble converting utf-8 resource to string
Have you tried constructing a StreamReader object (passing in the Stream object + Encoding into the StreamReader constructor) then calling XDocument.Load(StreamReader) to create the document? On 15/04/2012 6:26 PM, Greg Keogh wrote: Folks, I have an XML file as an embedded resource. The file looks like this and I know it's utf-8 encoded because in the binary editor I can see it starts with 0xEFBBBF Foobar However, when I run the following code to get the raw bytes from the resource and convert it to a string I don't get the nice string I expect. The resulting string starts with the character 0xfeff which is a Unicode BOM and then XDocument dies attempting to parse that string. using(Stream s = typeof(Program).Assembly.GetManifestResourceStream("MyProgram.XMLFile1.xml")) { byte[] buff = new byte[s.Length]; s.Read(buff, 0, buff.Length); string xml = Encoding.UTF8.GetString(buff, 0, buff.Length); XDocument doc2 = XDocument.Parse(xml); // This dies because xml[0] is the character 0xfeff } I've tried different overloads of Encoding classes but it makes no difference. I could have sworn I was a boffin of bytes and encoding, but I've no idea what's going on here. Any ideas anyone? Greg
RE: Trouble converting utf-8 resource to string
>Have you tried constructing a StreamReader object (passing in the Stream object + Encoding into the StreamReader constructor) >then calling XDocument.Load(StreamReader) to create the document? Ah, now that consumes the resource bytes correctly, but the declaration is missing from the resulting XML One step forward, one back -- Greg
RE: Trouble converting utf-8 resource to string
>Ah, now that consumes the resource bytes correctly, but the declaration is missing from the resulting XML No, cancel that, it was just the way it was displayed in the debugger. The declaration is there. So you get the Stream from the embedded resource, then make a StreamReader(stream,utf8), then you can get the xml string ReadToEnd() and Parse() it, or Load() the stream directly -- Greg