Кошке
А ты подписался на rss?

Найди причину ошибки

by Игорь Лизунов 03.12.2008 10:53

Представьте себе, что вы пишете какую-то часть в большом проекте.

Естественно предположить, что в этом проекте используют O/RM (IdeaBlade, если кому интересно).

И вы пишете запрос к базе данных. Предположим вам надо выбрать клиентов, живущих на какой-то улице. Естественно предположить, что у вас есть таблицы Client, Address, City, Street. Естественно предположить, что ту же самую таблицу адресов хочется использовать для адресов например фирм, организационных подразделений и так далее. После недолгих размышлений вы приходите к выводу, что оптимальнее всего забить на FK и сделать там, где нужен адрес, поле addressId (соответственно можно делать почтовый и юридический адрес, например), а в таблице адресов будет не куча линков по всем возможным связям, а одно поле contextId (как реальные пацаны, вы естественно забили на использование интов в качестве ключей и используете гуиды). Кто хочет поспорить - велкам!

Вам для построения объектного запроса нужно указать эту связь. Естественно, что такие связи автоматический генератор не распознал, и их приходится добавлять вручную. Все связи в этой O/RM хранятся в классе EntityRelations в виде статических ридонли полей. Вы добавляете свой класс CustomEntityRelations и добавляете туда свою связку, указывая исходное поле и дочернее. Пишете запрос, используя эту связку и запускаете приложение.

Минута тишины - и вылетает ошибка : ContextSwitchDeadlock.

В подробностях этой ошибки следующее: The CLR has been unable to transition from COM context 0x7968976 to COM context 0x654564. Blah-blah-blah.

Если быть до конца честным, то это скорее варнинг в визуал студии, который срабатывает, когда студия думает что произошел deadlock.

А теперь, внимание - вопрос: что было причиной ошибки?

Можете спрашивать все, что хотите, я буду выступать в роли интернета и визуалстудии, то есть помогать вам дойти до верного ответа. Обещаю что в конце вас ждет сюрприз :-)

2Паша Самолысов: Попробуй только запостить спойлер!!!

Tags: , , ,

Комментарии

03.12.2008 14:24:36 #

Павел

Я хочу поспорить. Простите мне мое занудство, но жизнь с Hibernate, Axis и прочими тулзам приучила меня к тому, что если тулза генерит что-то (код, метаданные, etc), то надо добиваться, чтобы она сгенерила их корректно. Писать руками то, что должно сгенериться тулзой (из поста понятно, что в данном случае использование генератора тулзы это и есть нормальная практика) - это моветон и в некотором роде хак. Хуже только править руками то, что сгенерировалось тулзой. )))

Павел | Reply

03.12.2008 14:39:47 #

ilizunov

1) Тулза генерит все корректно (все, что есть в базе данных)
2) То, что я добавляю что-то в ассемблю с логикой домена - абсолютно нормально.
3) Тулза позволяет только настраивать представление того, что есть в базе данных - это абсолютно нормально. Все, что кроме этого - делается руками.
Так что это не хак, а нормальная практика. Тебя же не мучает совесть, когда ты добавляешь дополнительное свойство в класс, мапящийся на таблицу.

ilizunov | Reply

03.12.2008 15:01:23 #

Павел

Не-не-не, ты меня не понял. Тулза генерит все корректно, но класс который она должна генерить (покрайней мере ты мне говорил что эти классы генерятся) ты пишешь руками. Я так понял потому что связь не настроил, но это уже другая история.

Пример не корректен, класс мэпящийся на таблицу может быть написан руками, а может быть сгенерен по мэппингу с помощью hibtools. Тут все зависит от политики используемой при разработке (она одна для всех классов-сущностей). Либо мы все классы-сущности генерим, либо все пишем руками. Естественно, если мы их генерим - мы в них ничего не пишем, впрочем мы юзали другие хаки )))

Павел | Reply

03.12.2008 15:08:56 #

Павел

Не-не-не, ты меня не понял. Тулза генерит все корректно, но класс который она должна генерить (покрайней мере ты мне говорил что эти классы генерятся) ты пишешь руками. Я так понял потому что связь не настроил, но это уже другая история.

Пример не корректен, класс мэпящийся на таблицу может быть написан руками, а может быть сгенерен по мэппингу с помощью hibtools. Тут все зависит от политики используемой при разработке. Либо мы все классы-сущности генерим, либо все пишем руками. Естественно, если мы их генерим - мы в них ничего не пишем, впрочем мы юзали другие хаки )))

Павел | Reply

03.12.2008 15:15:45 #

ilizunov

Тулза генерит класс со всеми связями. Он называется EntityRelations. Я его не трогаю.
Когда мне нужно добавить что-то, чего нет (дополнительный релейшн), я это делаю руками в другом классе. Да, можно было бы сделать дизайнер и для этого. Но не сделали. Ну собственно не очень то и надо.

ilizunov | Reply

22.07.2010 7:30:36 #

wow gold

I have a great sense of humor and I enjoy laughing the goofy of her jokes.

wow gold | Reply

22.07.2010 7:58:35 #

Wow Mage

hey, your post really helps, today i receive the same troubles, and i do not know on what are the best registry cleaner. thank god i look google and discovered your post, it helps me get rid of my trouble. thanks again this thing, may i paste your article on my site? i will add the source. regards!

Wow Mage | Reply

22.07.2010 8:01:14 #

randyrun

I was wondering if you ever considered changing the layout of your blog?  Its very well written; I love what youve got to say.  But maybe you could a little more in the way of content so people could connect with it better.  Youve got an awful lot of text for only having one or two images.  Maybe you could space it out better?

randyrun | Reply

25.07.2010 0:31:14 #

wow gold

What a great website you have! You are absolutely right. :-D

wow gold | Reply

25.07.2010 1:28:21 #

love quotes

Awesome post you put some serious though into this and I appriecate your view on this subject.

love quotes | Reply

25.07.2010 2:37:03 #

only4game

This is getting a bit more subjective, but I much prefer the Zune Marketplace. The interface is colorful, has more flair, and some cool features like 'Mixview' that let you quickly see related albums, songs, or other users related to what you're listening to. Clicking on one of those will center on that item, and another set of "neighbors" will come into view, allowing you to navigate around exploring by similar artists, songs, or users. Speaking of users, the Zune "Social" is also great fun, letting you find others with shared tastes and becoming friends with them. You then can listen to a playlist created based on an amalgamation of what all your friends are listening to, which is also enjoyable. Those concerned with privacy will be relieved to know you can prevent the public from seeing your personal listening habits if you so choose.

only4game | Reply

28.07.2010 16:55:51 #

wow gold

Hi I found your site by mistake when i was searching Google for this registry cleaner issue, I must say your site is really helpful I also love the design, its amazing!. I don't have the time at the moment to fully read your sitebut I have bookmarked it and also add your RSS feeds. I will be back in a day or two. thanks for this site.

wow gold | Reply

28.07.2010 17:37:11 #

wow Hunter

I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own BlogEngine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.

wow Hunter | Reply

28.07.2010 18:19:54 #

google chrome

Internet and here rules are different and audience is different too.

google chrome | Reply

02.09.2010 16:17:40 #

wow gold

download

wow gold | Reply

02.09.2010 17:15:54 #

technology strategic

Great post I must say.. Simple but yet entertaining and engaging.. Keep up the good work!

technology strategic | Reply

02.09.2010 18:51:31 #

cheapest wow gold

Easily, the post is actually the freshest topic on the best registry cleaner in 2009. I harmonize with your conclusions and will eagerly look forward to your incoming updates. Just saying thanks will not just be enough, for the fantasti c lucidity in your writing. I will directly grab your rss feed to stay privy of any updates.

cheapest wow gold | Reply

03.09.2010 20:28:02 #

wow curse

Salutations, I am excited to read the whole content on this page and am very elated and excited to guess that you is doing a very fantastic job here to put all the goodies and information at one place, i will spread the word on this information with a shout out on my website.

wow curse | Reply

17.11.2010 9:30:52 #

timberland 14 inch boots

Instead, we see people with ugly timberland shoes store problems in whom God is working so they can bloom beautifully — just like I now see in my orchids whether they are “lumps” or blossoms! On a certain timberland work shoes day at a certain hour, we will pull into the station. Bands will be playing and flags waving. Once we get there, so many wonderful dreams will come true and the pieces of our timberland wheat shoes lives will fit together like a completed jigsaw puzzle. How restlessly we pace the aisles, *ing the minutes for timberland for you loitering --waiting, waiting, waiting for the station. It is a good thing that the God Who made us is not impatient with people like me with my timberland shoe company orchid. He lovingly thinks about us all the time timberland boots and he even temporarily gave up His heavenly home and his timberland traditional handsewn hold on diety to die for the sins of timberland mens custom world nearly 2,000 years ago. His death back then covered the sins of every cheap timberland boots person who will ever live. He then rose to life after three mens timberland chukka days and ever since has wanted us to accept His gracious act by loving Him and also those around us. When we do this, we will see people in a totally different timberland 14 inch boots light — one that redefines what it means to be ugly or different or weird or strange. http://www.timberland4you.co.uk/ YQ

timberland 14 inch boots | Reply

30.11.2010 5:16:37 #

coach shoes

nice post!!!They are made of simply the most beautiful leather. cheap michael jordan shoe have a hallmark - soft leather, and it's not by fluke. It actually brings us to our second reason why <a href="/post/2008/12/03/www.pickjuicycoutures.com/...5.html">juicy" rel="nofollow">www.pickjuicycoutures.com/...5.html">juicy couture wallet</a> are so great:The softer leather is, the longer it will last and the less it will show wear and tear. If you are a lover of things to keep, a Coach bag won't let you down. They actually get better as they get older (that's a mark of real fine leather). Even if you change your bags from time to time, you can be sure that when you clean out your wardrobes and get a new set of <a href="www.hotcoachoutlet.com/...c-39.html">coach factory outlet</a>, whoever will get your Coach bag will get to put some mileage into it too.Each <a href="http://www.freearticledirect.com/">article directory</a> is made with great attention to detail. The <a href="/post/2008/12/03/www.pickjuicycoutures.com/...5.html">juicy" rel="nofollow">www.pickjuicycoutures.com/...5.html">juicy couture purses</a> inspect each bag individually after it's completed to make sure that only the best leaves the factory floors. This of course means that you will not find those unexpected faults after spending a few hundred dollars on a bag. There's a quality control process that each bag must go through before it reaches a store, and of course they are returnable if you find something cheap jordon shoes.

coach shoes | Reply

02.12.2010 9:01:41 #

DKA

[url=www.videoconverterfactory.com/.../]Free 3GP to FLV Converter[/url]
[url=www.videoconverterfactory.com/.../]Free FLV to 3GP Converter[/url]
[url=www.videoconverterfactory.com/.../]HD Video Editing Software[/url]
[url=www.videoconverterfactory.com/.../]Free AVI to MP4[/url]
[url=www.videoconverterfactory.com/.../]Free FLV to 3GP[/url]
[url=www.videoconverterfactory.com/.../]Free FLV to AVI[/url]
[url=www.videoconverterfactory.com/.../]Free AVI to FLV[/url]
[url=www.videoconverterfactory.com/.../]Free AVI to 3GP Converter[/url]
[url=www.videoconverterfactory.com/.../]Converting FLV to MP4[/url]
[url=www.videoconverterfactory.com/.../]Free MP4 to FLV[/url]

DKA | Reply

02.12.2010 10:45:30 #

ugg australia boots


   Ugg boot is a legendary brand, you can't understand why it has a ugly and cunbersome appearance when you have first glimpse of her.But it has been a popular boot in the Eurasian land, now popoular wind blowing all over the world today.The guide of this wind is Euramerian stars.

ugg australia boots | Reply

03.12.2010 12:22:29 #

dd

/post/2008/12/03/http://www.blu-ray-software.net/blu-ray-ripper/" rel="nofollow">http://www.blu-ray-software.net/blu-ray-ripper/ blu ray ripper, /post/2008/12/03/www.blu-ray-software.net/blu-ray-ripper-for-mac/" rel="nofollow">www.blu-ray-software.net/blu-ray-ripper-for-mac/ mac blu ray ripper, /post/2008/12/03/http://www.blu-ray-software.net/blu-ray-creator/" rel="nofollow">http://www.blu-ray-software.net/blu-ray-creator/ blu ray burner, /post/2008/12/03/http://www.blu-ray-software.net/blu-ray-copy/" rel="nofollow">http://www.blu-ray-software.net/blu-ray-copy/ blu ray copy, www.blu-ray-software.net/blu-ray-video-converter/ blu ray converter and /post/2008/12/03/http://www.blu-ray-software.net/blu-ray-player/" rel="nofollow">http://www.blu-ray-software.net/blu-ray-player/ best blu ray player offer the best solution for blu-ray videos
Duplicate /post/2008/12/03/http://www.blu-ray-software.net/blu-ray-ripper/" rel="nofollow">http://www.blu-ray-software.net/blu-ray-ripper/ blu ray dvd with /post/2008/12/03/http://www.blu-ray-software.net/blu-ray-copy/" rel="nofollow">http://www.blu-ray-software.net/blu-ray-copy/ blu ray dvd copy, /post/2008/12/03/www.blu-ray-software.net/blu-ray-ripper-for-mac/" rel="nofollow">www.blu-ray-software.net/blu-ray-ripper-for-mac/ blu ray ripper mac for Mac OS and /post/2008/12/03/http://www.blu-ray-software.net/blu-ray-creator/" rel="nofollow">http://www.blu-ray-software.net/blu-ray-creator/ blue ray burner are good /post/2008/12/03/http://www.blu-ray-software.net/blu-ray-player/" rel="nofollow">http://www.blu-ray-software.net/blu-ray-player/ blu ray player software

dd | Reply

03.01.2011 17:43:36 #

g401

порно фильмы, лесбийские порно фильмы на http://www.rueros.com
порнофильмы, порнофильм matador на http://www.eromovi.com
новые секс фильмы онлайн на http://ero.cbg.ru
горничная порнофильм на http://xmov.nov.ru

порно фильмы 80 х онлайн на http://list.rueros.com
порнофильмы фистинг на http://list.eromovi.com

g401 | Reply

Добавить комментарий




biuquote
  • Комментарий
  • Предпросмотр
Loading



Спасибо BlogEngine.NET за основу блога.

Комментарии

Comment RSS