This is a migrated thread and some comments may be shown as answers.

Domain Model / Visual Designer questions

11 Answers 254 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
cayates
Top achievements
Rank 1
cayates asked on 21 Jul 2010, 11:59 PM
Hello, just upgraded to Q2 2010 and decided to give this Domain Model thing a shot.  The upgrade feature failed with an object reference exception, however, I would like to just start from scratch anyway.

Now playing around with the visual designer I'm running into several issues/questions and I am hoping you can address each of them.

1) I have several schemas in my database.  In those schemas there are 507 tables and 1,458 procedures.  This causes the "Update from Database" dialog window to take a very long time to load.  The procedure's I will never map and most of the schemas I will never map.  Is there a way to ignore all the procedures and/or schemas except the ones I'm interested in so that the dialog doesn't take so long to come up every time?

2) I'm having a problem getting the navigation properties to automatically create.  For example, I already have table A on the diagram.  I add table B to the diagram which has foreign keys to table A.  It automatically detects that and creates the association, but not the navigation properties.  If I delete the association and re-create it using the association tool then it does automatically create the navigation properties.

3) I have a table which has two foreign keys to the same table; an UpdateUser column and CreateUser column which are both foreign keys to the User table.  If I delete both relationships in order to re-create them for it to create the navigation properties, only the first one will work.  When I use the association tool for the second foreign key it acts as though the foreign key isn't there and brings up the mapping dialog, of which the columns I would use are not listed.

4) How do I enhance these generated classes with custom methods?  In the old way I would reverse engineer the table and copy and paste the generated code from the openaccess file to the main class and not lose my custom methods.  Every time I make changes in this visual designer it is regenerated the classes and overwriting the whole thing.

That's it for now, sorry for the long post.  Your help is greatly appreciated.

Thanks,

Chris

11 Answers, 1 is accepted

Sort by
0
cayates
Top achievements
Rank 1
answered on 22 Jul 2010, 12:04 AM
Sorry, I forgot about these:

5) There are a few instances where two different schemas have a table with the same name.  In the update from database dialog it lumps all the tables together and you can't tell which schema the table is from.  For example, you can have two tables named FooBar from two different schemas.

6) Because of this I accidentally added the wrong schema's table.  After realizing this I couldn't figure out how to remove it from the Model Schema Explorer as a grayed out icon.  I tried going back into the update from database dialog and choosing "Remove" by the table but that did not work.

Thanks,

Chris
0
Zoran
Telerik team
answered on 23 Jul 2010, 07:38 PM
Hello cayates,

 Nice to know that you have chosen to try the domain model out. Here are some clarifications for your points:

  1. This is actually a very nice proposal from your side. We have not put such UI for choosing the schemas that are of interest to the user, but we will definitely do this enhancement for later versions of the product.
  2. This seems to be a bug in the drag-drop functionality from the schema explorer. You have already found the workaround, but we will make sure it is fixed for the next internal build or service pack that we will release publicly.
  3. The part where only the first association is resolved from the database definition is by design at the moment, as whenever the user wants multiple associations between classes we guide him to fine-tune them intentionally as best-guessing each association can easily bring the model into an inconsistent state. However not-having your columns available for selection is something that should not be the case. On the left side of the association editor you should be able to select the foreign key column and on the right side, the primary key column that the previous one points to. 
  4. The generated classes are partial classes and you can always create additional partial classes where you can place your logic. It is on our agenda to create a command from the Visual Designer that creates such class for you automatically.
  5. This is another thing that we consider a good suggestion on your side and we will include it in the product as soon as the next service pack release.
  6. The purpose of the Add/Remove/Modify command in Update From Database is to point the difference between the two models, the one you have in the designer and the one coming from the database - in case OpenAccess has assumed wrong. But in this case you can not select that the table was removed from the old model as it was never there. The changes that you see there however will not be applied unless you choose "Apply Selected" for the change entry in question, but you can not manually remove change operations from the dialog.
I hope my answer provider helpful for you. If you have any additional questions or require further clarification, please do not hesitate to contact us back.


Best wishes,
Zoran
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Wiktor
Top achievements
Rank 1
answered on 27 Jul 2010, 10:50 AM
Hi Zoran,

thanks for your replies.

I must agree with cayates here, because I was also unable to find any way to remove table from my model.
You can add the table (via "Update from database" option or by hand with "Add new table"), but it cannot be removed. You can fully manipulate with table columns (as well as delete them), but nothing can be done with table as soon as it was added to model. You cannot even change the table or schema names (when you click on "Edit table", fields are editable, but changes are silently ignored).

I am working with ORM version 2010.2.714.1.

There is also one thing I noticed. When you select an option to generate Entity classes in separate files, they are not physically deleted from project, when table is removed from design window.

Hope this will help to improve your product.
Regards,
Wiktor
0
Wiktor
Top achievements
Rank 1
answered on 27 Jul 2010, 12:05 PM
Hi Zoran,

additionaly to cayates' point 1, I would like to add than in Oracle, when you connect using user with "SELECT ANY TABLE" grant you will have all tables/views in your whole database instance - which, even counting the system ones are tens of hurnders.
If I may suggest - you could add some text fields, where user can specify which schemas/tables to look for in the database (using wildcad symbols). Otherwise Update from database operation takes ages.

Regards,
Wiktor
0
cayates
Top achievements
Rank 1
answered on 27 Jul 2010, 06:23 PM
Hello,

Yes, thank you for replying Zoran.  The only response I did not fully understand is for issue #6.  Wiktor reiterated the issue which is the fact that once a table is added to the Model Schema Explorer it can't be removed.

Despite these issues I continued with the Domain Model and things were going very well until 34 tables into my model.  I came across these two issues, which I will continue adding to the previous 6 to keep things from getting confusing:

7) This issue may just be me not knowing how to accomplish the task.  I need to do a many to many relationship and have a join table, all of which have been in use with previous versions of Open Access with no issues.  When I try to create the relationship I check "Use join table", however, the table I need to select is not in the drop down.  Only None and Create new are shown in the drop down.  I have added the table to the model, however, nothing I've tried has caused it to show up in the drop down.

8) This issue appears to be a bug with the code generation process.  One table in my model, which coincidentally is the one with the largest number of properties, is giving an error when trying to compile.  The steps I took to cause the error were to manually create an association which doesn't have a corresponding foreign key in the database.  I then had to delete the original column that was generated which was for the foreign key so I could rename the association to be the same name as the foreign key column's name.  Now the error I'm getting is "The type 'CJIS.Model.Defendant' already contains a definition for 'ParoleOfficer'.  So I looked at the source code, and sure enough, the generated code for the property is in there twice with the same name.  I tried deleting it and recreating it, and that caused 3 copies of the generated code and two errors.  I have tried deleting the class file and letting it regenerate but that didn't work.  I really don't want to delete the table from the model and remap it because I have already spent a good deal of time setting up several other associations and I don't want to have to do that all over again.

Your help with these issues would be greatly appreciated.
0
cayates
Top achievements
Rank 1
answered on 27 Jul 2010, 07:54 PM
Also regarding issue #8, I also tried deleting the association on the diagram and I'm getting the error "The deleted association is not part of the OpenAccess MetaModel" and then the association doesn't delete.  I'm sure this has to do with the problem.
0
cayates
Top achievements
Rank 1
answered on 27 Jul 2010, 08:25 PM
Well, after reverting back to last nights backup of the code, then deleting each association and property, then remapping the properties, and recreating the associations I was able to get rid of that error.  Unfortunately a new error has popped up now when trying to compile.  Here it is:

Error 3 Errors were generated when initializing the transformation object. The transformation will not be run.  The following Exception was thrown:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.OpenAccess.Metadata.MetadataXmlSerializer.SetAssociationTypeForInverseCollection(MetaAssociation association)
   at Telerik.OpenAccess.Metadata.MetadataXmlSerializer.ReadInverseCollectionMember(XmlNode collectionNode, MetaPersistentType persistentType)
   at Telerik.OpenAccess.Metadata.MetadataXmlSerializer.ReadInverseCollectionsForPersistentClasses()
   at Telerik.OpenAccess.Metadata.MetadataXmlSerializer.ReadNavigationMembersForPersistentTypes()
   at Telerik.OpenAccess.Metadata.MetadataXmlSerializer.ReadPersistentTypes(XmlElement rootElement)
   at Telerik.OpenAccess.Metadata.MetadataXmlSerializer.Deserialize(XmlDocument configuration)
   at Telerik.OpenAccess.Metadata.MetadataXmlSerializer.DeserializeFromReader(XmlReader reader)
   at Telerik.Data.Dsl.EntityDiagramsSerializationHelper.ModelLoader.LoadModel(SerializationResult serializationResult, Partition partition, String fileName, ISchemaResolver schemaResolver, ValidationController validationController)
   at Telerik.Data.Dsl.EntityDiagramsSerializationHelper.LoadModel(SerializationResult serializationResult, Partition partition, String fileName, ISchemaResolver schemaResolver, ValidationController validationController)
   at Telerik.Data.Dsl.EntityDiagramsSerializationHelperBase.LoadModel(SerializationResult serializationResult, Store store, String fileName, ISchemaResolver schemaResolver, ValidationController validationController)
   at Microsoft.VisualStudio.TextTemplating719FA4EC41894DF32DD9C65B00379AD2.GeneratedTextTransformation.Initialize() in c:\Users\Chris\Documents\Source\CJIS\CJIS Framework\EntityDiagrams.rlinq:line 34
   at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(String fullClassName, String baseClassName, String[] importedNamespaces, String[] references, String source, String inputFile, Boolean debug, SupportedLanguages language, IDictionary`2 languageOptions, IFormatProvider format, ITextTemplatingEngineHost host, Boolean cacheAssemblies, String& result) 1 1



Error 4 A namespace does not directly contain members such as fields or methods C:\Users\Chris\Documents\Source\CJIS\CJIS Framework\EntityDiagrams.cs 1 1 CJIS Framework

0
cayates
Top achievements
Rank 1
answered on 27 Jul 2010, 08:35 PM
Well, I double clicked the error to view the source code of the EntityDiagrams.rlinq file and now I can't get back to the visual designer.  When I try I get an "The operation could not be completed. Invalid pointer" error.

The Domain Model feature seems nice but appears to be way too buggy to be used at this point, unfortunately.
0
Alexander
Telerik team
answered on 02 Aug 2010, 06:09 PM
Hello,

@Wiktor:
Thank you for pointing that out, we will consider adding an option to completely exclude a table (or any other relational object) from the model.
We have already addressed the issue of loading all Oracle schemas. With the next version of the product (even in the internal build which should be available in a few days) you will be able to select from a list which schemas are read and shown in the treeview of the Add new item wizard.

@cayates:
7) In the join table combobox we are currently showing only the tables which are detected as join tables and the ones created by the "Create new join table" option. So if your table has more than two foreign key columns, most likely it will not be shown in the dropdown. In one of the next versions we will provide an option to manually set if a table is actually a join table.
8) This seems to be related to the problem you described in the last two posts. We are still investigating this behavior and will let you know when we have more information. We are sorry for the troubles you are experiencing with our product, we will do our best to solve them soon.

Best wishes,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Lafama
Top achievements
Rank 1
answered on 14 Sep 2010, 06:10 PM
hi
How do i map an IDictionary<int,string> attribute using the new domain model.
Am getting an error when i try to define the type using the property panel

Thanks
0
Alexander
Telerik team
answered on 16 Sep 2010, 03:52 PM
Hi Lafama,

I am afraid that dictionaries are not supported yet. We will try to provide support for them in Q3.
At the moment you can achieve similar behavior by adding another class (and table) which has two properties - an int and a string. Then you can have a list of such objects in the class that should have had a dictionary and use Linq to find the needed string based on the int value.

Kind regards,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
cayates
Top achievements
Rank 1
Answers by
cayates
Top achievements
Rank 1
Zoran
Telerik team
Wiktor
Top achievements
Rank 1
Alexander
Telerik team
Lafama
Top achievements
Rank 1
Share this question
or