John-acme's Profile User Rating: -----

Reputation: 6 Worker
Active Members
Active Posts:
86 (0.05 per day)
08-February 11
Profile Views:
Last Active:
User is offline Aug 08 2015 12:09 AM

Previous Fields

OS Preference:
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:

Latest Visitors

Icon   John-acme has not set their status

Posts I've Made

  1. In Topic: Make Periodically Self-Updated Object

    Posted 25 Jul 2015

    cfoley : I tried to make a JFrame, instantiate and make it visible in test, but unfortunately it did behave differently from usually I see. The frame only showed up a while and the test finish, not even waiting any input from user.

    Sure things! actually there many more events (eat, eat own body, crash to stone or wall, enter tunnel). Actually, It is a replica of HungrySnake mini game. (Just in oversimplified UI) LOL. But for now I want to test the ability to move and to be directed.

    CasiOo: I do consider your suggestion 'favor composition over inheritance', and I do think that composition might give better structure (because from the beginning, SnakeHead and Moveable did not hold 'is a' relationship). But If I do use composition, I cannot figure out how to make Moveable behavior like a plugin. I mean, I want whatever class (whether it is Snake, Dragon, or any reptile) as long as it is have Moveable class (whether it is by extending or composing), then those class will able to move itself periodically.

    But unfortunately, Until I make this reply, I have not figured the way to use composition (and of course I will keep searching). Anyway, I do appreciate your warning 'To not use Thread.sleep in test', that's new to me.

    If your are kind, give me more hint! Thanks.
  2. In Topic: Domain Model and Entity Framework

    Posted 27 Jun 2015

    RudiVisser : On my way testing further before arrive at 3 layer separation. I encounter a problem, I create a UI project. My Ui project only contain text filed to show StandardID and StandardName and a Button to Load the field.

    I connect UI project and my model base on Service Reference. So inside project that contain my Student class and Standard class I add web service (asmx) file. Inside the web service file I just add get method like below
    public Standard GetStandardByID(int id) {
    	SchoolContext scontext = new SchoolContext();
    	Standard std = scontext.Standards.Where(stan => stan.StandardId == id)/*.Select(t => new {
    		StandardId = t.StandardId,
    		StandardName = t.StandardName
    	return std;

    But In my Standard class, the properties of Students return ICollection<>, instead concrete object List<>
    public ICollection<Student> Students { get; set; } //I use this instead of following line
    //public List<Student> Students { get; set; } 

    And I get error when add the service reference to UI project.
    the error is ::


    Request format is unrecognized for URL unexpectedly ending in '/_vti_bin/ListData.svc/$metadata'.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/_vti_bin/ListData.svc/$metadata'.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/_vti_bin/ListData.svc/$metadata'.]
    System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +489329
    System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +212
    System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +47
    System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +346
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

    When I changed back to use List<> then all was fine my UI able to show standardID and standardName.
  3. In Topic: Domain Model and Entity Framework

    Posted 26 Jun 2015

    Ah.. as RudiVisser suggested, I run debug and i found that Standard property in my result is null. then I try to change the query for result become
    Student result = (from stud in context.Students
    							  join stan in context.Standards
    							  on stud.StandardKey equals stan.StandardId
    							  where stud.StudentID == 90002
    							  select stud).SingleOrDefault();

    and the result still null, How to select Student with Standard included in?
    for the relationship on modelBuilder, I follow this tutorial EF Tutorial. I think their code is not wrong.

    Am I miss something?

    Updated :
    I try to change the result into this :
    Student result = context.Students.Include(s => s.Standard).Where(s => s.StudentID == 90002).SingleOrDefault();

    And the result is success. the ToString() method is invoked. Now it is clear that POCO in Code-First approach can be used can have behavior and use for other things.

    Now still on similar problem. Above test is conducted on same project.
    I want to try to follow best practice of 3 layer structure. But for now let's discuss 2 layers which are BusinessLayer and DataAccessLayer. Each those layer will be one project, so total 3 project for 3 layer. As per theory, upper layer may depend on lower layer but not vice versa (or circular dependency occur).

    I plan to divide My Domain Object and the EF. Domain Object on BusinessLayer and EF(DbContext-derived class and all mapping syntax) stay on DataAccessLayer. Problem is now EF cannot recognize any of my DomainObject (my POCO). How should I done this? I tried partial class, but it was failed. DataAccessLayer cannot recognize any class from BusinessLayer. How should I do the mapping?
  4. In Topic: Combine same functionality services into one

    Posted 16 Jun 2015

    Skydiver: Well, it is not I married to Entity Framework. I would love to switch if there are better alternative at hand. And as for now, Entity Framework looks like (maybe) easier to put my hand on rather than ADO.NET, (at least) until before I post this question.



    Once I had a working API, I came to the conclusion that EF was getting in the way

    I do not understand in what way EF getting in the way. Did you mean the EF getting in the way same as in my case?


    Using plain old SQL, I got a focused library with almost no dependencies. Warning: putting EF in a library is so horribly cumbersome as to be pointless

    I do not understand what you mean 'library' is and 'no dependencies' are, would you mind to give more concrete example? And mind if I have a glance on your code?(maybe I can also get something new by reading your code, I want to see if yours and mines have similarity). Thanks

    After I looking around for some time, looks like there are no way to put some abstraction layer over every each entities generated from my database model. Did you agree on this? And also, database and my code inevitably will have high coupling.

    Curtis Rutland: Thanks for your suggestion. I have a flash view on dapper, it is appealing. I would love to learn more.Thanks
  5. In Topic: Object Referred Properties (Best Practice Q)

    Posted 12 Jun 2015

    I see, so second approach is better. Thanks to both of you.^.^

    Skydiver: I would like to explore more about your suggestion (about ID should be hidden) and about object databases. I have search in Google 'object databases' and what it was showed up is DBMS like Virtuos or others where as I use SQL Server. I do not know SQL Server is Object Database or Relational Database. But What I got is what you mean is not the software but the approach in programming, object database approach. I never know this approach, as I am being taught that each row in database's table is represented by an object in programming. I would like to ask few links or sources that explain object database approach, if you do not mind. Thanks

My Information

Member Title:
D.I.C Head
23 years old
October 27, 1992
Medan, Indonesia
Programming, Books(Financial and Business)
Full Name:
Programming Languages:
Java (learning)

Contact Information

Click here to e-mail me


John-acme hasn't added any friends yet.


John-acme has no profile comments yet. Why not say hello?