Newby question

Sep 8, 2010 at 3:16 AM

I'm trying to use your ORM framework, and everything seems to be working fine in the test project, but I can't seem to find an actual pubs.sdf file.  Where is the sql compact .sdf file located?

Sep 8, 2010 at 2:08 PM

The ORM creates the database file for you.  Look at the SqlCEStoreTest.cs, line 37.  If you look at the Initialize method, you'll see that it deletes and recreates the store with every run.

Sep 8, 2010 at 2:26 PM
Edited Sep 8, 2010 at 2:29 PM

Yes I see that and I appreciate the code and the reply.  But I was wondering if you took the DeleteStore() call out it would persist as a sdf file?  I can't seem to make that happen.  Here's my dilemma:  I need a RowVersion column in each table to be able to get the locally cached changes and sync with the server.  I had planned to manually add the column to the sdf file and handle the query with a linq or tableadapter to work around (since the application will only need to know about this column during the sync).  Another solution would be to add this datatype to the supported types.  Do you have any advice?


Again, much thanks for the code and time.



Sep 8, 2010 at 2:30 PM

Yes, if you removed the "DeleteStore, the database would persist (though you also would want to remove the CreateStore call, since the store would exist).

What data type is the column you're looking at?  I thought I had added support for most everything in an earlier change set.

Sep 8, 2010 at 2:43 PM
The relatively new db type rowversion.
Sep 8, 2010 at 3:29 PM

Get the latest changeset.  It has support for rowversion.  You need to define the Field as an 8-byte type (i.e. long or ulong in C#) and set the IsRowVersion property of the FieldAttribute to true.

Sep 8, 2010 at 4:04 PM

I just verified I have the latest changeset (76554), and I don't see any IsRowVersion property in FieldAttribute.  Here is my FieldAttribute code:

    public class FieldAttribute : Attribute
        private DbType m_type;

        public FieldAttribute()
            // set up defaults
            AllowsNulls = true;
            IsPrimaryKey = false;
            SearchOrder = FieldSearchOrder.NotSearchable;
            RequireUniqueValue = false;
            Ordinal = -1;

        public string FieldName { get; set; }
        public int Length { get; set; }
        public int Precision { get; set; }
        public int Scale { get; set; }
        public bool AllowsNulls { get; set; }
        public bool IsPrimaryKey { get; set; }
        public bool RequireUniqueValue { get; set; }
        public int Ordinal { get; set; }
        public FieldSearchOrder SearchOrder { get; set; }
        public PropertyInfo PropertyInfo { get; internal set; }
        internal bool DataTypeIsValid { get; private set; }

        public DbType DataType 
            get { return m_type; }
                m_type = value;
                DataTypeIsValid = true;

        public override string ToString()
            return FieldName;

Sep 8, 2010 at 4:13 PM

76994 is the latest *release* not the latest change set.  Clikc on "source Code" and you'll see two change sets since that release.  76995, checked in this morning, is the one you're after.

Sep 8, 2010 at 4:13 PM

Sorry now I see your check-in change set 76995.  Thanks again.