Skip to end of metadata
Go to start of metadata

Questions

Please only add questions here if you have an answer or a link to an answer. If not, please post the question to the user mailing list. Details subscription details can be found here.

  • I would like to write the objectcontext to the filesystem instead of a datbase. how can that be accomplished? (Added to the FAQ pages)
  • Can strongly typed collections (entity lists) be customised? We'd like Neo to generate '''MyEntityListBase''', and we'll derive from it in '''MyEntityList'''. Can this be configured optionally? (Yes, by modifying the templates.)
  • Are columns with a unique-value constraint supported by Neo? (Added to the FAQ pages)
  • What are ExtendedProperties on ObjectContext for? Are these anything to do with ITypedList?(Added to the FAQ pages)
  • GuidPkInitialiser has quite a fancy implementation. Why not just use `System.Guid.NewGuid()` ? (Added to the FAQ pages)
  • Regarding the '''default''' attribute on '''column''' in the Xml... what does it do?
  • Has anyone out there made progress on adding support for compound foreign keys? (Added to the FAQ pages)
  • Erik, you mentioned once that it was possible to create a sub-ObjectContext; one that could be thrown away, or if accepted, it's changes would be propogated to its parent context. How is this done? (Added to the FAQ pages)
  • What is the difference between the foreign-key and the iforeign-key element? (Added to the FAQ pages)
  • Is there a way to order atribute in #foreach($attribute in $entity.Attributes)? (As of Neo 1.3.1 attributes, relations, etc. should appear in the order they are specified in the model file.)

Discoveries (Q&A)

  • Why is Neo changing the case of my attributes? When I specify "HelloWorld", I get "Helloworld" in code.

Use

defaultJavaNamingMethod="nochange"

on the

<database ... />

tag in your schema.

  • How can I specify that Guids for new entities should be created automatically? I have defaultIdMethod="none", and my factory's Create method expects a Guid parameter.

Use

defaultIdMethod="guid"

in the database tag.

NeoCmdLine

Command line options:

  • d - debug
  • sql - gen sql create scripts
  • sqldrop - gen sql drop scripts
  • support - gen support files (_Entity.cs)
  • user - gen user files (Entity.cs)
  • f - force overwrite
  • r - resource path (seems to be relative to the schema path...?)
    Q. Is this a path to the template files *.vtl? (It is, but you generally override it with the neo processing directive in the schema file.)
  • o - output path

Up to date command line help can be found here

Q. Could you please provide one or two examples of the command line options?

Here's what I do:

neo.exe -r resources -o generated -sql true -sqldrop true -support true -user true storemodel.xml

The schema file is called ''storemodel.xml''. The ''resources'' folder contains ''norque.dtd'', the templates(''*.vtl'') and schema generator ''*.xslt''-files. Output goes to a folder called ''generated''.

Self referential tables

Q. Are self-referential tables supported?

A. Yes. Self referential tables can be used to model heirarchical tree-like structures. Here is an example of how a self referential table may be specified.

<table name="AnalysisCategory" description="AnalysisCategory table">
    <column name="AnalysisCategoryId" primaryKey="true" required="true" type="UNIQUEIDENTIFIER"/>
    <column name="ParentId" required="false" type="UNIQUEIDENTIFIER"/>
    <column name="Name" required="true" type="VARCHAR" size="50"/>

    <!-- self-referential table -->
    <foreign-key foreignTable="AnalysisCategory" name="ParentCategory">
        <reference local="ParentId" foreign="AnalysisCategoryId"/>
    </foreign-key>
    <iforeign-key foreignTable="AnalysisCategory" name="ChildCategories" onDelete="cascade">
        <ireference local="AnalysisCategoryId" foreign="ParentId"/>
    </iforeign-key>
</table>

Qualifiers

When using qualifier strings to find entities via a factory, the format appears to be (for example):

myFactory.FindFirst("ColumnName = {0}", myValue);

Note that the following line won't work (it was the first thing I'd tried, and gave a generic error, making it tricky to debug):

myFactory.FindFirst("{0} = {1}", "ColumnName", myValue); // fails
Labels: